1. Anatomy of the Linux Terminal Command
When you open a terminal in Linux Mint, you are interacting with GNU Bash (Bourne Again Shell). The command prompt presents critical system context:
TEXTSYSTEM SCHEMATIC
anupam@mint-workstation:~/projects$ ls -la /var/log
[---1--] [------2------] [---3----] [4] [5] [---6---]- 1Current User:
anupam - 2Hostname:
mint-workstation - 3Current Directory:
~/projects(~is shorthand for the user's home directory/home/anupam) - 4Command:
ls(list directory contents) - 5Options / Flags:
-la(-lfor long detailed format,-afor all files including hidden dotfiles) - 6Argument:
/var/log(the target path)
§
2. Directory Navigation & Inspection Mastery
BASHSYSTEM SCHEMATIC
# Print Working Directory
pwd
# List contents with human-readable file sizes and timestamps
ls -lh
# List all files including hidden configuration dotfiles (.bashrc, .profile)
ls -la
# Change directory using absolute and relative paths
cd /var/log # Absolute path to /var/log
cd .. # Move up one level into /var
cd ../etc # Move into sibling directory /etc
cd ~ # Return to current user's home directory
cd - # Toggle back to previous working directory§
3. File & Directory Manipulation
Linux treats almost everything as a stream of bytes or a file. The core utilities for creating, inspecting, copying, and removing files include:
BASHSYSTEM SCHEMATIC
# Create a new empty file or update timestamps
touch notes.txt
# Create nested directory trees in a single command
mkdir -p projects/python/scripts
# View entire file contents
cat /etc/os-release
# Paginate large files with search capabilities (press 'q' to exit, '/' to search)
less /var/log/syslog
# View top 10 lines or continuously stream new log entries in real time
head -n 10 /etc/passwd
tail -f /var/log/syslog
# Copy files and directories recursively
cp notes.txt backup_notes.txt
cp -r projects/ projects_backup/
# Move or rename files
mv notes.txt ideas.txt
# Remove files and directories safely
rm ideas.txt
rm -r projects_backup/ # Recursive directory deletion
rm -rf temp_folder/ # Force recursive deletion (use with extreme caution!)§
4. Standard Streams & I/O Redirection
Every process launched by the shell is automatically provided with three standard file descriptors:
TEXTSYSTEM SCHEMATIC
+-----------------------+
[ stdin (0) ] | | [ stdout (1) ] -> Terminal Screen
-------------> | Linux Process | =================> File ( > or >> )
Keyboard | (e.g., cat) |
| | [ stderr (2) ] -> Error Log
+-----------------------+ =================> ( 2> or 2>&1 )Redirection Operator Syntax
| Operator | Stream | Behavior | Example |
|---|---|---|---|
> | stdout (1) | Overwrite target file with command output | ls -l > inventory.txt |
>> | stdout (1) | Append command output to end of file | date >> audit.log |
< | stdin (0) | Feed file contents as input into command | wc -l < inventory.txt |
2> | stderr (2) | Redirect only error messages to file | cat invalid.txt 2> error.log |
&> or 2>&1 | stdout & stderr | Merge both standard output and errors into file | make build &> build.log |
§
5. Pipelines & Text Processing Tools
The true power of the Unix philosophy is chaining simple, single-purpose tools together using the pipe operator (|):
BASHSYSTEM SCHEMATIC
# Find all active users with /bin/bash shell
cat /etc/passwd | grep "/bin/bash"
# Count the number of system packages installed
dpkg -l | grep "^ii" | wc -l
# Search for the word 'error' in syslog, ignore case, and sort unique occurrences
grep -i "error" /var/log/syslog | sort | uniq -c | sort -rn | head -n 5
# Locate all PDF files modified in the user's Downloads folder
find ~/Downloads -type f -name "*.pdf"