This Week's Nugget: Five Shell One-Liners That Saved Me Time Every Week
Ishe Chinyoka
- 2 minutes readTable of Contents
One of the joys of becoming a textsmith is discovering that a single line typed into the terminal can save minutes of repetitive work. Five minutes here, ten minutes there, and before long you’ve recovered hours that would otherwise have been spent clicking through menus or repeating the same task.
Here are five one-liners that earned a permanent place in my mental toolbox.
1. Find large files hiding in a directory
Running out of disk space is frustrating. This command quickly reveals the biggest files beneath the current directory.
find . -type f -printf '%s %p\n' | sort -nr | head -10You’ll instantly see the ten largest files.
Why it matters: perfect for tracking down forgotten downloads, VM images, or enormous log files.
2. Search every Markdown file for a phrase
Instead of opening files individually:
rg "textsmith" *.mdor, recursively,
rg "textsmith"This quickly tells you where an idea has already appeared.
Why it matters: invaluable when writing documentation or maintaining a Hugo site.
3. Count how many times a word appears
rg -o "Markdown" | wc -lNeed to know whether you’ve overused a particular word?
The shell happily counts for you.
Why it matters: useful when editing articles or looking for repeated terminology.
4. Rename every Markdown file
Suppose every post should become lowercase.
for f in *.md; do
mv "$f" "$(echo "$f" | tr A-Z a-z)"
doneOne command replaces dozens of manual renames.
Why it matters: perfect when reorganizing websites or documentation.
5. Preview every shell script in your toolbox
find ~/.local/bin -type f -executable | lessSometimes you’ve forgotten what tools you’ve written.
Browsing your own toolbox can remind you that yesterday’s solution already exists.
Why it matters: your own scripts become reusable only if you remember they exist.
The Lesson
Notice something interesting.
None of these commands is especially complicated.
None uses advanced shell programming.
Each solves one small annoyance.
That is exactly how experienced shell users become productiveβnot by memorizing hundreds of commands, but by collecting dozens of tiny solutions to recurring problems.
Today’s one-liner becomes tomorrow’s shell script.
Tomorrow’s shell script becomes next year’s indispensable utility.
Your toolbox grows one solved problem at a time.
Textsmith’s Tip
Whenever a one-liner saves you from doing the same task twice, don’t leave it in your shell history.
Save it in a notebook, your dotfiles repository, or better still, turn it into a small executable script in ~/.local/bin/.
The shell history remembers what you typed.
Your personal toolbox remembers what you’ve learned.