TerminalAll Developers
This Linux cheatsheet is designed for real developer workflows, from daily navigation to production incident debugging on servers.
Change directory
cd <path>Tree view (if installed)
tree -L 2Create nested directory
mkdir -p <path/to/dir>Copy recursively
cp -r <source> <destination>Move or rename
mv <source> <destination>Remove file/folder safely
rm -rf <path>Find file by name
find . -name '<filename>'Find by extension and size
find . -type f -name "*.log" -size +100MFind and delete old files
find /tmp -type f -mtime +7 -deleteShow first and last lines
head -n 20 <file> && tail -n 20 <file>Sort and unique count
cat <file> | sort | uniq -c | sort -nr | headChange mode
chmod 755 <file-or-dir>Change owner
chown <user>:<group> <file-or-dir>Recursive ownership update
chown -R <user>:<group> <directory>Add executable permission
chmod +x <script.sh>Set SGID on directory
chmod 2775 <shared-dir>Default ACL for shared directory
setfacl -R -m d:g:<group>:rwx <dir>Show running processes
ps aux | headProcess tree
ps -ef --forest | lessMonitor processes interactively
topMonitor with better UI (if installed)
htopFind process by name
pgrep -af <process-name>Kill process
kill -9 <pid>Check systemd status
systemctl status <service>Restart service
sudo systemctl restart <service>Check listening ports
ss -tulpnPort ownership details
lsof -i :<port>DNS lookup
dig <domain> +shortRoute and interface info
ip addr && ip routeQuick connectivity test
curl -I https://<host>HTTP timing breakdown
curl -o /dev/null -s -w "dns=%{time_namelookup} connect=%{time_connect} ttfb=%{time_starttransfer} total=%{time_total}\n" https://<host>Follow file logs
tail -f /var/log/<file>.logShow recent system logs
journalctl -xeFollow service logs
journalctl -u <service> -fLogs from last 1 hour
journalctl -u <service> --since "1 hour ago"Error-focused service logs
journalctl -u <service> -n 500 | grep -Ei "error|fatal|panic|exception"Kernel warnings
dmesg -T | tail -n 50Directory size summary
du -sh * | sort -hTop largest directories
du -xhd1 / | sort -h | tail -n 20CPU and memory by process
ps aux --sort=-%mem | head -n 15I/O stats (if installed)
iostat -xz 1 5Create tar.gz
tar -czf archive.tar.gz <folder>Extract tar.gz
tar -xzf archive.tar.gzCreate zip recursively
zip -r archive.zip <folder>Sync folders with rsync
rsync -avh --delete <src>/ <dest>/Copy over SSH
scp <file> user@host:/path/Resume download
curl -L -C - -o <file> <url>Top memory consumers
ps aux --sort=-%mem | head -n 20Top CPU consumers
ps aux --sort=-%cpu | head -n 20Find deleted-but-open files
lsof +L1Who logged in recently
last -a | headRecent failed SSH logins
grep "Failed password" /var/log/auth.log | tail -n 50Check if app port is reachable
nc -zv 127.0.0.1 <port>