One of my favorite command line tips: you can add 'comments'
full of keywords to shell commands, which makes searching your command history easier.
> obscure-cmd --with-weird-flags -Qdt # searchable comment keywords
Presumably you're using something like fzf for history search, but this is
still useful without it.
This is especially useful for cli tools with obscure names/flags, or when you can't remember where a particular log file is.
Some examples from my history:
tail awesomewm logs:
tail -f ~/.cache/awesome/logs -n 2000 # tail follow log awesomewm
fix linux clock drift:
sudo ntpd -qg && sudo hwclock --systohc # fix linux clock time drift
copy ngrok public url to clipboard:
curl -s http://localhost:4040/api/tunnels | jq ".tunnels[0].public_url" | tr -d '"' | tr -d '\n' | xclip -selection clipboard -i # fetch ngrok url uri, copy to clipboard
sign ssh and gpg, then refresh the emacs keychain env:
keychain --agents gpg,ssh --eval id_rsa <some-gpg-id> && emacsclient -e '(keychain-refresh-environment)' # sign ssh,gpg password, refresh emacs env
Another gpg one:
git config commit.gpgsign false # disable gpg signing for this repo
Pacman/pamac commands, like listing orphaned packages:
pacman -Qdt # list orphans
pamac list -o # list orphans
xprop - super useful for debugging window management, for some reason i can
never remember what it's called:
xprop # mouse click window x11 linux describe info client helper whateveritscalled
Some helpers from my clawe project:
bb --config ~/russmatney/clawe/bb.edn -x clawe.sxhkd.bindings/reset-bindings # reset sxhkd bindings
bb --config ~/russmatney/clawe/bb.edn -x clawe.restart/reload # reload clawe
Aliases come to mind as well - in some cases that might be a better fit. I like
this because it's so low-lift.
There are a few collections around like: https://github.com/adi1090x/rofi
These things tend to imply dependencies for how they're implemented plus whatever they are integrating. The UX is definitely the right one tho! Rofi is great for working on custom dev tools - you can pass lines in as stdin, it sends back the selected item on stdout, then you exec the matching output command.
I started a project called 'ralphie' to do this with babashka a couple years ago, but later i absorbed that into a monorepo called clawe - you can see the rofi namespace here: https://github.com/russmatney/clawe/blob/3987390ffe538d878045e9d886190542fb111b9e/src/ralphie/rofi.clj#L146-L156