A practical perspective on the commands that really matter
cd - Change directoryls - List directory contents-l (long), -a (all), -h (human-readable)
pwd - Print working directorycp - Copy files and directories-r for recursive directory copies
mv - Move or rename filesrm - Remove files and directories-rf with extreme caution!
mkdir - Make directory-p to create parent directories
find - Search for files in directory hierarchyfind /path -name "*.txt"
cat - Concatenate and display file contentsless - Page through text filesmore, search with /
head - View beginning of file-n to specify
tail - View end of filetail -f for live log monitoring is essential!
vi or vim - Text editornano - Simple text editorgrep - Search text patternsgrep "pattern" file, use -r for recursive
sed - Stream editorsed 's/old/new/g'
awk - Pattern scanning and processingcut - Extract sections from linessort - Sort lines of text-n for numeric, -r for reverse
uniq - Report or filter repeated linessort | uniq
wc - Word, line, character, and byte countwc -l for line count is very common
ps - Show running processesps aux shows all processes
top or htop - Interactive process viewerkill - Terminate processeskill -9 for force kill (use sparingly)
killall - Kill processes by namedf - Disk space usage by filesystemdf -h for human-readable output
du - Disk usage by directory/filedu -sh * shows size of items in current dir
free - Memory usagefree -h for human-readable
uptime - System uptime and loadw or who - Who is logged inw shows more detail
chmod - Change file permissionschmod 755 file or chmod +x script
chown - Change file ownerchown user:group file
chgrp - Change group ownershipumask - Default file permissionsping - Test network connectivityssh - Secure shell remote accessscp - Secure copy over SSHrsync - Remote/local file synchronizationip or ifconfig - Network interface configurationip is newer, but ifconfig still common
netstat or ss - Network connectionsss is the modern replacement for netstat
curl - Transfer data from/to serverswget - Download files from webDebian/Ubuntu:
apt / apt-get - Package managementapt update, apt upgrade, apt install package
dpkg - Low-level package tooldpkg -i package.deb, dpkg -l to list
RHEL/Fedora/CentOS:
dnf / yum - Package managementdnf install package, dnf update
rpm - Low-level package toolrpm -ivh package.rpm, rpm -qa to list
Arch Linux:
pacman - Package managementpacman -S package, pacman -Syu to update
systemctl - Control systemd servicessystemctl start/stop/restart/status servicesystemctl enable/disable service for boot
journalctl - Query systemd journaljournalctl -u service for service logsjournalctl -f to follow logs
tar - Archive filestar -czf archive.tar.gz filestar -xzf archive.tar.gz
gzip / gunzip - Compress/decompress filesbzip2 / bunzip2 - Better compressionln - Create linksln -s target linkname for symbolic links
diff - Compare filesxargs - Build command pipelinesscreen or tmux - Terminal multiplexingIt's not about memorizing every flag and option. It's about:
man command becomes second nature>, >>, <, |, 2>&1 - this is where the real power is| 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 |
Importance comes from four key factors:
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.
find /path -name "*.txt" - Find by namefind /path -type f -mtime -7 - Modified in last 7 daysfind /path -size +100M - Larger than 100MBlocate filename - Fast search using database
grep "pattern" file - Basic searchgrep -r "pattern" /path - Recursive searchgrep -i "pattern" file - Case insensitivegrep -v "pattern" file - Invert match (show non-matching)
tar -czf archive.tar.gz files/ - Create compressed archivetar -xzf archive.tar.gz - Extract compressed archivetar -tzf archive.tar.gz - List contents without extracting
chmod 755 file - rwxr-xr-xchmod 644 file - rw-r--r--chmod +x file - Add execute permissionchown user:group file - Change owner and group
ps aux | grep process - Find specific processkill -9 PID - Force kill processkillall process_name - Kill all by nametop or htop - Interactive monitoring
man command religiously - the manual pages are comprehensivecommand --help for quick syntax remindershistory to see your command history!! to repeat the last command!$ to reference the last argument of the previous command.bashrc or .zshrc