Tired of the usual df -h and uname -a? Here are 10 advanced one-liners that help real sysadmins diagnose, audit, and monitor faster.
1️⃣ Find files modified in the last 7 days, larger than 100MB:
find / -type f -mtime -7 -size +100M 2>/dev/null
2️⃣ Check top 10 memory-consuming processes with live updates:
watch -n 1 "ps aux --sort=-%mem | head"
3️⃣ List all listening ports with associated processes:
lsof -i -P -n | grep LISTEN
4️⃣ Get your server’s public IP without third-party scripts:
dig +short myip.opendns.com @resolver1.opendns.com
5️⃣ Check inode usage across filesystems (useful for mail servers):
df -i
6️⃣ Find zombie processes:
ps -eo pid,ppid,state,cmd | awk '$3=="Z"'
7️⃣ Quickly check CPU usage per core:
mpstat -P ALL 1 3
8️⃣ Check which processes are using swap:
for pid in $(ls /proc | grep -E '^[0-9]+$'); do awk '/VmSwap/{print $2 " kB\tPID=" '"$pid"'}' /proc/$pid/status 2>/dev/null; done | sort -n
9️⃣ Find largest directories in /var (top 5):
du -Sh /var | sort -rh | head -n 5
10️⃣ Live bandwidth usage per interface:
ifstat -t
Which of these do you use, or do you have your own hidden gems? Drop one below to share with fellow admins.
Stay tuned for next week’s Sysadmin Sunday tip to keep sharpening your command-line edge
Top comments (0)