5 Tiny CLI Tricks You (Probably) Didn't Know
A lightning-round of command-line nuggets to level-up your dev workflow.
1. history | grep + fzf = instant recall
Fish out that elusive command you ran last Tuesday:
history | grep docker | fzf
Hit Enter and it pastes right back to your prompt like magic.
2. Reverse-search a Git log by file content
Combine git log
with -S
(search diff) to find when a string first appeared:
git log -S"resizeObserver" --oneline -- src/components/Layout.tsx
3. JSON-pretty print with zero dependencies
Mac & Linux already ship with python3
:
cat response.json | python3 -m json.tool | less
4. One-liner port-forwarding for quick demos
Need to expose localhost:3000
? Use SSH—no ngrok token needed.
ssh -R 80:localhost:3000 ssh.localhost.run
Now share the generated URL on Slack and watch eyebrows rise.
5. Measure anything with time + subshell
How long does your linter actually take?
time (npm run lint > /dev/null)
💡 Pro-tip: wrap this in a
pre-push
hook so slow commands get caught early.
Conclusion
These tiny CLI tricks can save you significant time in your daily development workflow. From finding old commands instantly to measuring performance and setting up quick demos, mastering these patterns will make you more efficient at the command line.
Try incorporating one or two of these into your routine this week and see how they improve your productivity!