Chapter 16: Troubleshooting
System Investigation
journalctl -xe
journalctl -u service -n 50
journalctl -p err --since today
tail -f /var/log/syslog
tail -f /var/log/nginx/error.log
Disk and Memory
df -h
du -sh /* 2>/dev/null | sort -hr
free -h
cat /proc/meminfo
Network Issues
ping gateway
curl -v https://site.com
ss -tuln | grep :80
traceroute 8.8.8.8
Process Issues
ps aux | grep Z
lsof -i :80
lsof -p PID
Troubleshooting Methodology
- Define the problem clearly
- Gather information (logs, metrics)
- Form a hypothesis
- Test one change at a time
- Document what you did
- Check logs first, always
- Isolate the layer: hardware, OS, service, app