Linux commands
The commands I reach for most when troubleshooting. Filter by category, click copy.
| Command | What for | |
|---|---|---|
ip -br a | Interfaces and IPs, short format | |
ss -tulpn | Listening ports and the process behind them | |
mtr -rwc 50 8.8.8.8 | Traceroute + packet loss per hop | |
dig +short example.com | Quick DNS lookup | |
curl -sv -o /dev/null https://example.com | TLS handshake and HTTP headers | |
tcpdump -ni eth0 port 443 | Capture traffic on a port | |
htop | Live CPU, memory and processes | |
df -h | Disk usage per filesystem | |
free -h | Memory usage | |
systemctl status nginx | Status of a service | |
journalctl -u nginx -f | Follow a service's logs | |
tail -f /var/log/syslog | Follow the system log | |
grep -i error /var/log/syslog | Find errors in a log | |
find / -name '*.conf' 2>/dev/null | Find files by name | |
chmod 600 key.pem | Lock down an SSH key | |
rsync -avz src/ user@host:/dst/ | Sync folders over SSH |