Bash one-liners I keep looking up
7 Sep 2026
A personal cheat sheet. Nothing clever, just things I search for every few months.
Largest directories
du -h --max-depth=1 . | sort -h | tail
What is listening on a port
ss -tlnp | grep :8080
Rename files to lowercase
for f in *; do mv -n -- "$f" "${f,,}"; done
Find files changed in the last day
find . -type f -mtime -1
Repeat a command until it succeeds
until ping -c1 -W1 example.com; do sleep 2; done