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

CommandWhat it doesExample
find . -type f -printf '%s %p ' | sort -nr | head -10Shows the 10 biggest files under the current directory.find . -type f -printf '%s %p ' | sort -nr | head -10
ps aux --sort=-%mem | headShows the top memory-consuming processes.ps aux --sort=-%mem | head
ps aux --sort=-%cpu | headShows the top CPU-consuming processes.ps aux --sort=-%cpu | head
grep ERROR app.log | sort | uniq -c | sort -nr | headCounts 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 :8080Finds 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 -1Shows files modified in the last 24 hours.find . -type f -mtime -1
du -sh * | sort -hShows directories sorted by size.du -sh * | sort -h
curl -fsS http://localhost:8080/actuator/healthChecks a health endpoint quietly and fails on error.curl -fsS http://localhost:8080/actuator/health
zgrep -n 'timeout' *.gzSearches 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 springKills processes matching spring in the full command.pkill -f spring
history | tail -50Shows recent terminal commands.history | tail -50
vimdiff app.yml app-prod.ymlCompares 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.