Linux Cheatsheet
Comprehensive Linux command reference with 200+ commands. Search, filter by category, and click to copy.
Linux Cheatsheet
Essential Linux commands for everyday use
Commands
Categories
Favorites
Sections
pwdPrint working directory
cd [dir]Change directory
cd ~Go to home
cd -Previous directory
cd ..Go up one level
lsList contents
ls -laLong format with hidden
ls -lhHuman-readable sizes
ls -lSSort by size
treeDirectory tree
cp [src] [dest]Copy file
cp -r [src] [dest]Copy directory
mv [src] [dest]Move/rename
rm [file]Remove file
rm -rf [dir]Force remove dir
mkdir -p [path]Create nested dirs
touch [file]Create empty file
ln -s [target] [link]Symbolic link
tar -czvf archive.tar.gz [files]Create gzipped tar
tar -xzvf archive.tar.gzExtract gzipped tar
zip -r archive.zip [dir]Create zip
unzip archive.zipExtract zip
cat [file]Display file
less [file]View with paging
head -n 20 [file]First 20 lines
tail -n 20 [file]Last 20 lines
tail -f [file]Follow file
grep [pattern] [file]Search pattern
grep -i [pattern] [file]Case-insensitive
grep -r [pattern] [dir]Recursive search
grep -n [pattern] [file]Show line numbers
sort [file]Sort lines
uniq [file]Remove duplicates
wc -l [file]Count lines
sed 's/old/new/g' [file]Replace text
awk '{print $1}' [file]Print first column
ps auxAll processes
ps aux | grep [name]Find process
topReal-time viewer
htopInteractive viewer
pgrep [name]Get PID by name
kill [pid]Terminate process
kill -9 [pid]Force kill
killall [name]Kill by name
bgResume in background
fgBring to foreground
nohup [cmd] &Run immune to hangups
uname -aSystem info
hostnameShow hostname
uptimeSystem uptime
whoamiCurrent user
lscpuCPU info
lsblkBlock devices
df -hDisk space
du -sh [dir]Directory size
du -sh * | sort -hrSorted by size
ncduInteractive disk usage
free -hMemory usage
vmstatVirtual memory stats
ip aShow IP addresses
ifconfigNetwork config
hostname -IShow local IPs
ping [host]Test connectivity
traceroute [host]Trace route
nslookup [domain]DNS lookup
dig [domain]DNS lookup detailed
netstat -tulnListening ports
ss -tulnListening ports (modern)
lsof -i :[port]Process using port
curl [url]Fetch URL
wget [url]Download file
scp [file] [user]@[host]:[path]Copy via SSH
rsync -avz [src] [dest]Sync files
chmod 755 [file]Set rwxr-xr-x
chmod +x [file]Add execute
chown [user] [file]Change owner
chown -R [user] [dir]Recursive chown
💡 r=4, w=2, x=1. Example: 755 = rwxr-xr-x
sudo [command]Run as superuser
sudo -iRoot shell
su - [user]Switch user
useradd -m [user]Create user with home
userdel -r [user]Delete user with home
usermod -aG [group] [user]Add to group
passwd [user]Set password
groupadd [group]Create group
groups [user]Show user groups
apt updateUpdate package list
apt upgradeUpgrade packages
apt install [pkg]Install package
apt remove [pkg]Remove package
apt search [pkg]Search packages
yum install [pkg]Install package
dnf install [pkg]Install (Fedora)
find [dir] -name [pattern]Find by name
find [dir] -type fFind files only
find [dir] -mtime -7Modified in 7 days
find [dir] -size +100MLarger than 100MB
systemctl start [service]Start service
systemctl stop [service]Stop service
systemctl status [service]Service status
systemctl enable [service]Enable at boot
journalctl -u [service]Service logs
crontab -eEdit cron jobs
crontab -lList cron jobs
💡 Format: minute hour day month weekday command
Quick Reference
ls -la
find . -name "*"
grep pattern file
df -h
ps aux
About Linux Commands
Linux commands are the foundation of system administration and development. This cheatsheet covers essential commands for file management, text processing, process control, networking, and more.