Essential & Most Important Linux Commands

A practical perspective on the commands that really matter

The Absolute Core - Can't Live Without These

Navigation & File Operations CRITICAL

cd - Change directory
You'll use this hundreds of times a day
ls - List directory contents
Essential flags: -l (long), -a (all), -h (human-readable)
pwd - Print working directory
Know where you are at all times
cp - Copy files and directories
Use -r for recursive directory copies
mv - Move or rename files
Does double duty - moves AND renames
rm - Remove files and directories
⚠️ Use -rf with extreme caution!
mkdir - Make directory
Use -p to create parent directories
find - Search for files in directory hierarchy
Incredibly powerful: find /path -name "*.txt"

Viewing & Editing CRITICAL

cat - Concatenate and display file contents
Quick way to view files
less - Page through text files
Better than more, search with /
head - View beginning of file
Default 10 lines, use -n to specify
tail - View end of file
tail -f for live log monitoring is essential!
vi or vim - Text editor
MUST know basics - it's on every system
nano - Simple text editor
Easier alternative, but vi is more universal

Text Processing - The Power Tools HIGH PRIORITY

grep - Search text patterns
Fundamental: grep "pattern" file, use -r for recursive
sed - Stream editor
Quick text transformations: sed 's/old/new/g'
awk - Pattern scanning and processing
More complex text processing and data extraction
cut - Extract sections from lines
Great for parsing delimited data
sort - Sort lines of text
Use -n for numeric, -r for reverse
uniq - Report or filter repeated lines
Often used with sort: sort | uniq
wc - Word, line, character, and byte count
wc -l for line count is very common

Process & System Management CRITICAL

ps - Show running processes
ps aux shows all processes
top or htop - Interactive process viewer
Real-time system monitoring
kill - Terminate processes
kill -9 for force kill (use sparingly)
killall - Kill processes by name
Careful with this one!
df - Disk space usage by filesystem
df -h for human-readable output
du - Disk usage by directory/file
du -sh * shows size of items in current dir
free - Memory usage
free -h for human-readable
uptime - System uptime and load
Quick system health check
w or who - Who is logged in
w shows more detail

Permissions & Ownership CRITICAL

chmod - Change file permissions
Absolutely critical: chmod 755 file or chmod +x script
chown - Change file owner
chown user:group file
chgrp - Change group ownership
Alternative to chown for just group changes
umask - Default file permissions
Sets default permissions for new files

Networking HIGH PRIORITY

ping - Test network connectivity
Basic troubleshooting tool
ssh - Secure shell remote access
You'll live in this as a sysadmin
scp - Secure copy over SSH
Quick file transfers
rsync - Remote/local file synchronization
More powerful than scp, handles incremental copies
ip or ifconfig - Network interface configuration
ip is newer, but ifconfig still common
netstat or ss - Network connections
ss is the modern replacement for netstat
curl - Transfer data from/to servers
Incredibly versatile HTTP/API tool
wget - Download files from web
Great for downloading files non-interactively

Package Management CRITICAL

Debian/Ubuntu:

apt / apt-get - Package management
apt update, apt upgrade, apt install package
dpkg - Low-level package tool
dpkg -i package.deb, dpkg -l to list

RHEL/Fedora/CentOS:

dnf / yum - Package management
dnf install package, dnf update
rpm - Low-level package tool
rpm -ivh package.rpm, rpm -qa to list

Arch Linux:

pacman - Package management
pacman -S package, pacman -Syu to update

System Services HIGH PRIORITY

systemctl - Control systemd services
systemctl start/stop/restart/status service
systemctl enable/disable service for boot
journalctl - Query systemd journal
journalctl -u service for service logs
journalctl -f to follow logs

The "You'll Be Glad You Know These"

tar - Archive files
Create: tar -czf archive.tar.gz files
Extract: tar -xzf archive.tar.gz
gzip / gunzip - Compress/decompress files
Single file compression
bzip2 / bunzip2 - Better compression
Slower but smaller than gzip
ln - Create links
ln -s target linkname for symbolic links
diff - Compare files
Shows differences line by line
xargs - Build command pipelines
Execute commands from standard input
screen or tmux - Terminal multiplexing
Lifesaver for long-running tasks and remote sessions

The Philosophy

It's not about memorizing every flag and option. It's about:

  1. Knowing what's possible - Understanding that a tool exists for what you need
  2. Reading man pages - man command becomes second nature
  3. Combining tools - The Unix philosophy of small tools that do one thing well, connected via pipes
  4. Understanding I/O redirection - >, >>, <, |, 2>&1 - this is where the real power is

I/O Redirection - The Real Power

Symbol Purpose Example
> Redirect output (overwrite) ls > files.txt
>> Redirect output (append) echo "text" >> file.txt
< Redirect input sort < unsorted.txt
| Pipe output to another command ps aux | grep apache
2> Redirect stderr command 2> errors.txt
2>&1 Redirect stderr to stdout command > output.txt 2>&1
&> Redirect both stdout and stderr command &> all_output.txt

What Makes a Command "Important"?

Importance comes from four key factors:

The Controversial Take

About sed and awk: Some "essential" lists heavily emphasize sed and awk. My thought: Yes, learn them, but also know that for complex tasks, sometimes a Python or bash script is clearer and more maintainable than a one-liner that looks like line noise.

The best sysadmins know when to use the elegant one-liner and when to write the readable script.

Balance elegance with maintainability. Your future self (and your colleagues) will thank you.

Quick Reference - Most Common Usage Patterns

Finding Files

find /path -name "*.txt" - Find by name
find /path -type f -mtime -7 - Modified in last 7 days
find /path -size +100M - Larger than 100MB
locate filename - Fast search using database

Searching in Files

grep "pattern" file - Basic search
grep -r "pattern" /path - Recursive search
grep -i "pattern" file - Case insensitive
grep -v "pattern" file - Invert match (show non-matching)

Archives

tar -czf archive.tar.gz files/ - Create compressed archive
tar -xzf archive.tar.gz - Extract compressed archive
tar -tzf archive.tar.gz - List contents without extracting

Permissions

chmod 755 file - rwxr-xr-x
chmod 644 file - rw-r--r--
chmod +x file - Add execute permission
chown user:group file - Change owner and group

Process Management

ps aux | grep process - Find specific process
kill -9 PID - Force kill process
killall process_name - Kill all by name
top or htop - Interactive monitoring

Tips for Mastery