TL;DR 5 trucchi CLI rapidi: ricerca history con fzf, git log -S per cercare nei contenuti, python3 json.tool per il pretty-print, port forwarding SSH senza ngrok, misurazione comandi con time + subshell.

Italiano

5 Tiny CLI Tricks You (Probably) Didn’t Know


Count is 0


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.

FAQ

Serve installare qualcosa per questi trucchi?
No — fzf è l'unico tool opzionale; il resto è già incluso in una shell/git/python3 standard.