Essential Linux Commands Cheat Sheet
File & Directory Navigation
ls List directory contents
cd <dir> Change to directory
pwd Show current directory path
mkdir <dir> Create a new directory
rmdir <dir> Remove empty directory
rm -r <dir> Remove directory and contents
touch <file> Create an empty file
find . -name "*.txt" Find files by name
File Operations
cp <src> <dest> Copy file or directory
mv <src> <dest> Move or rename file/directory
rm <file> Delete file
cat <file> Show file contents
less <file> View file one page at a time
head -n 10 <file> Show first 10 lines
tail -n 10 <file> Show last 10 lines
nano <file> Open file in nano editor
System Info & Management
uname -a Show kernel info
top Show real-time processes
ps aux Show running processes
df -h Show disk space usage
du -sh <dir> Show size of a directory
free -h Show memory usage
uptime Show how long system is running
whoami Show current user
id Show user and group IDs
Package Management (Debian/Ubuntu)
sudo apt update Refresh package list
sudo apt upgrade Upgrade installed packages
sudo apt install <pkg> Install a package
Essential Linux Commands Cheat Sheet
sudo apt remove <pkg> Remove a package
sudo apt search <term> Search for a package
Networking
ping <host> Ping a server
ifconfig / ip addr Show network interfaces
curl <url> Fetch URL contents
wget <url> Download a file
netstat -tuln Show open ports
ss -tulwn Faster netstat alternative
Permissions & Ownership
chmod +x <file> Make file executable
chmod 755 <file> Set permissions
chown user:group <file> Change ownership
ls -l Show detailed file info with permissions
Searching & Filtering
grep "text" file.txt Search text in file
grep -r "text" dir/ Recursively search in dir
find / -name "file.txt" Find a file anywhere
sort <file> Sort lines in a file
uniq <file> Remove duplicate lines
wc -l <file> Count lines
System Cleanup
sudo apt autoremove Remove unused packages
sudo apt clean Clear package cache
Archive & Compression
tar -cvf file.tar dir/ Create tar archive
tar -xvf file.tar Extract tar archive
gzip file.txt Compress file
Essential Linux Commands Cheat Sheet
gunzip file.txt.gz Decompress file
zip archive.zip file.txt Create zip archive
unzip archive.zip Extract zip file