tgp4

Tiny shell helpers I keep rewriting

2026-01-09

Every time I get a new laptop I notice that I reach for the same handful of shell helpers in the first week. They're never part of my dotfiles repo because they feel too small to commit, and so I end up typing them out from memory each time. This post is mostly for future me.

Find the biggest things in a directory

du -sh -- * 2>/dev/null | sort -h | tail -n 20

Run this at the root of whatever disk is suspiciously full. Nine times out of ten it's a forgotten Docker volume or a node_modules that nobody is using.

Quick HTTP server in the current directory

python3 -m http.server 8000

Embarrassingly useful. I use it for sharing a file on the local network, for previewing a static site, and for the occasional curl smoke test.

Watch a log with colour

tail -F /var/log/whatever | grep --color=always -E 'ERROR|WARN|$'

The trailing |$ keeps every line, but colours only the matches. I stole this years ago from a stackoverflow answer and it has never let me down.

The one I always forget

find . -type f -mtime -1

Files modified in the last day, from the current directory down. I reach for this whenever something mysterious has changed and I want to know what.

None of these are clever. That's sort of the point. The longer I do this job the more I appreciate small tools that do one thing and don't surprise me.