Whether you are deploying to a cloud server, debugging in Docker, or just becoming a better developer, Linux command line skills are non-negotiable. This cheat sheet covers the 50 commands you will actually use daily — organized by category, with clear examples. All commands verified on Ubuntu 24.04 LTS, with notes for macOS (Homebrew) alternatives where applicable.
1. File Operations
ls -la # List all files with details
cd /path # Change directory
pwd # Print working directory
cp src dest # Copy file
mv src dest # Move or rename file
rm file # Remove file
rm -rf dir # Remove directory recursively (be careful!)
mkdir dir # Create directory
touch file # Create empty file or update timestamp
find . -name "*.py" # Find files by name
cat file # Print file contents
head -n 20 file # Show first 20 lines
tail -f file # Follow file updates (great for logs)
2. Permissions
chmod 755 script.sh # rwx r-x r-x
chmod +x script.sh # Make executable
chown user:group file # Change owner
ls -l # View permissions
3. Process Management
ps aux # List all running processes
top # Real-time process monitor
htop # Better top (install separately)
kill -9 PID # Force kill a process
killall process_name # Kill by name
jobs # Show background jobs
fg %1 # Bring job 1 to foreground
4. Networking
curl https://api.example.com # HTTP request
curl -X POST -d '{"key":"val"}' URL # POST with JSON
wget https://example.com/file # Download file
ping google.com # Test connectivity
netstat -tulpn # Show open ports
ss -tulpn # Modern netstat
nslookup example.com # DNS lookup
ssh user@host # Connect via SSH
scp file user@host:/path/ # Copy file to remote
rsync -avz src/ dest/ # Sync directories
5. Text Processing
grep \"pattern\" file # Search for pattern
grep -r \"TODO\" . # Recursive search
sed 's/old/new/g' file # Replace text
awk '{print $1}' file # Print first column
sort file # Sort lines
uniq # Remove duplicates (after sort)
wc -l file # Count lines
diff file1 file2 # Compare files
6. Disk & System Info
df -h # Disk space
du -sh */ # Directory sizes
free -h # Memory usage
uname -a # System info
uptime # How long system has been running
lscpu # CPU info
lsblk # List block devices
7. Archives & Compression
tar -czvf archive.tar.gz dir/ # Create tar.gz
tar -xzvf archive.tar.gz # Extract tar.gz
zip -r archive.zip dir/ # Create zip
unzip archive.zip # Extract zip
8. Package Management
(Varies by distro: Ubuntu/Debian uses apt, CentOS/RHEL uses yum/dnf, macOS users have Homebrew, modern Python uses uv)
sudo apt update && sudo apt upgrade # Update system (Ubuntu)
sudo apt install package # Install package
brew install package # macOS (Homebrew)
uv add package # Python packages (modern)
pip install package # Python packages (traditional)
9. Pro Tips for 2026
- Use
Ctrl+Rto search command history. The most time-saving shortcut in the terminal. - Alias common commands:
alias ll='ls -la'in your.bashrcor.zshrc. - Use
tmuxorscreenfor persistent terminal sessions on remote servers. - Modern alternative:
ripgrep (rg)is faster thangrep,fdis faster thanfind,batis bettercat,fzffor fuzzy finding.
Bookmark this page. No one remembers all commands. Even senior developers Google tar flags every time.
FAQ
Which Linux distro should I use for development?
Ubuntu is the most beginner-friendly and has the largest community. Fedora is excellent for developers who want newer packages. Both are great choices.
Do I need to learn Linux as a web developer?
Yes. Most servers run Linux. Docker containers use Linux. CI/CD pipelines run on Linux. The command line is unavoidable.