Real Production One-Liners
These are short commands that solve common production tasks fast. Each one includes a one-line explanation and a copy-paste example.
One-Liner Reference
| Command | What it does | Example |
|---|---|---|
find . -type f -printf '%s %p
' | sort -nr | head -10 | Shows the 10 biggest files under the current directory. | find . -type f -printf '%s %p
' | sort -nr | head -10 |
ps aux --sort=-%mem | head | Shows the top memory-consuming processes. | ps aux --sort=-%mem | head |
ps aux --sort=-%cpu | head | Shows the top CPU-consuming processes. | ps aux --sort=-%cpu | head |
grep ERROR app.log | sort | uniq -c | sort -nr | head | Counts the most repeated error lines. | grep ERROR app.log | sort | uniq -c | sort -nr | head |
find /opt -type f -name '*.jar' | Finds all JAR files under /opt. | find /opt -type f -name '*.jar' |
lsof -i :8080 | Finds which process owns port 8080. | lsof -i :8080 |
tail -f app.log | grep -E 'ERROR|WARN|Exception' | Follows logs live and shows only serious lines. | tail -f app.log | grep -E 'ERROR|WARN|Exception' |
find . -type f -mtime -1 | Shows files modified in the last 24 hours. | find . -type f -mtime -1 |
du -sh * | sort -h | Shows directories sorted by size. | du -sh * | sort -h |
curl -fsS http://localhost:8080/actuator/health | Checks a health endpoint quietly and fails on error. | curl -fsS http://localhost:8080/actuator/health |
zgrep -n 'timeout' *.gz | Searches compressed logs for timeout. | zgrep -n 'timeout' *.gz |
df -h | awk 'NR==1 || $5+0 > 80' | Shows filesystems over 80% usage. | df -h | awk 'NR==1 || $5+0 > 80' |
pkill -f spring | Kills processes matching spring in the full command. | pkill -f spring |
history | tail -50 | Shows recent terminal commands. | history | tail -50 |
vimdiff app.yml app-prod.yml | Compares two files side by side in vim. | vimdiff app.yml app-prod.yml |
Tip
Save your favorite one-liners into a personal shell file or internal wiki. A good engineer builds a reusable command toolkit instead of searching from zero every time.