Quick Reference

Your command-line cheatsheet. Bookmark this page for quick lookup.

⌨️ Keyboard Shortcuts

Ctrl + CInterrupt/cancel current command
Ctrl + ZSuspend current process
Ctrl + DExit shell / EOF
Ctrl + LClear screen
Ctrl + RReverse search history
Ctrl + AMove cursor to line start
Ctrl + EMove cursor to line end
Ctrl + UClear line before cursor
Ctrl + KClear line after cursor
TabAuto-complete
!!Repeat last command
!$Last argument of previous command

File Operations

ls -laList all files with details
ls -lhList with human-readable sizes
cd -Go to previous directory
mkdir -p dir/sub/dirCreate nested directories
cp -r src/ dest/Copy directory recursively
mv old newRename or move file
rm -rf dir/Remove directory forcefully
ln -s target linkCreate symbolic link

Text Processing

grep -r "pattern" .Search recursively in current dir
grep -i "text" fileCase-insensitive search
sed 's/old/new/g' fileReplace all occurrences
sed -i "" 's/a/b/g' fileIn-place edit (macOS)
awk '{print $1}' filePrint first column
awk -F: '{print $1}' /etc/passwdCustom delimiter
sort -u fileSort and remove duplicates
wc -l fileCount lines

File Permissions

chmod 755 filerwxr-xr-x (executable)
chmod 644 filerw-r--r-- (readable)
chmod +x script.shAdd execute permission
chmod -R 755 dir/Recursive permission change
chown user:group fileChange owner and group
chown -R user dir/Recursive ownership change

Archives & Compression

tar -czf archive.tar.gz dir/Create tar.gz archive
tar -xzf archive.tar.gzExtract tar.gz archive
tar -tvf archive.tar.gzList archive contents
zip -r archive.zip dir/Create zip archive
unzip archive.zipExtract zip archive
gzip fileCompress file (replaces original)
gunzip file.gzDecompress gzip file

Process Management

ps auxList all running processes
ps aux | grep nodeFind specific process
top -o cpuSort by CPU usage
kill -9 PIDForce kill process
killall processnameKill all by name
nohup cmd &Run in background (survives logout)
jobsList background jobs
fg %1Bring job 1 to foreground

Networking

curl -I urlFetch headers only
curl -o file urlDownload to file
curl -X POST -d "data" urlPOST request
wget -c urlDownload with resume
ssh user@hostSSH connection
scp file user@host:pathSecure copy to remote
ping -c 5 hostPing 5 times
netstat -tulnShow listening ports

System Information

df -hDisk usage (human-readable)
du -sh dir/Directory size
du -h --max-depth=1Size of subdirectories
free -hMemory usage
uname -aSystem information
uptimeSystem uptime and load
whoamiCurrent username
hostnameMachine hostname

Git Essentials

git statusCheck working tree status
git diffShow unstaged changes
git log --oneline -10Last 10 commits, compact
git branch -aList all branches
git checkout -b branchCreate and switch branch
git stashStash changes
git stash popApply stashed changes
git reset --hard HEAD~1Undo last commit

📄 Need a Printable Version?

Use your browser's print function (Ctrl/Cmd + P) to save this as a PDF.

Press Ctrl+P (Windows) or Cmd+P (Mac)