CHEATSHEET • LINUX & SRE TRIAGE

Linux Sysadmin & Troubleshooting Cheatsheet

Verified Linux commands for first-5-minute incident triage, process/port inspection, disk & memory diagnostics, systemd services, and log parsing.

01First-5-Minute System & Performance Triage

Check CPU load averages (1m, 5m, 15m) and available RAM
uptime && free -h
Check mounted filesystem space and inode exhaustion
df -hT && df -ih
Find the top 10 largest directories consuming disk space
du -xh --max-depth=1 /var | sort -hr | head -n 10
List top 10 processes sorted by memory or CPU consumption
ps aux --sort=-%mem | head -n 11
Sample virtual memory, context switches, and I/O wait every 1s
vmstat 1 5
Check kernel ring buffer for OOM-killer or hardware errors
dmesg -T | grep -iE "oom|kill|error" | tail -n 20

02Sockets, Ports & Process Inspection

List all listening TCP/UDP sockets with owning PIDs
ss -tulpn
Find which process is holding open a specific port
sudo lsof -i :8080
Measure DNS, TCP connect, TLS, and TTFB latency via curl
curl -o /dev/null -s -w "DNS:%{time_namelookup}s Connect:%{time_connect}s TTFB:%{time_starttransfer}s Total:%{time_total}s\n" https://example.com
Gracefully reload (HUP) or terminate a process by name
pkill -HUP nginx
Advertisement

03Systemd, Logs & Text Processing

Restart a systemd service and check its active status
sudo systemctl restart nginx && sudo systemctl status nginx --no-pager
Follow systemd unit logs from the current boot
sudo journalctl -u nginx -b -f
Extract top 10 client IP addresses from an Nginx access log
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head -n 10
Find all .log files modified more than 7 days ago
find /var/log -type f -name "*.log" -mtime +7

04Archives, Sync & Permissions

Create and extract a gzip-compressed tar archive
tar -czvf backup.tar.gz /etc/nginx && tar -xzvf backup.tar.gz
Synchronize a local directory to a remote host over SSH
rsync -avz --progress ./dist/ deploy@server:/var/www/app/
Set executable permissions on a script and update ownership
chmod 750 deploy.sh && sudo chown deploy:devops deploy.sh
Copied to clipboard!