sudo !! Is nice but I mostly use the up arrow to repeat something long and complicated I did 10 minutes ago. The joke there is sometimes that takes too long too. So that’s where history | grep 'keyword' is nice
If it’s bash, it’s using readline, which is in emacs-like mode by default, and so you can probably use Control-R to do a reverse i-search (incremental search). Enter to invoke the command. Control-C to abort i-search.
If a search matches multiple candidates, tap Control-R multiple times to cycle back through results.
EDIT: Also, ! has a built-in search, so if you are sure of the starting string, you can just do that. I generally prefer to use the interactive search to confirm that I’m not invoking something wonky.
It keeps its handses on the home row.
sudo !!Is nice but I mostly use the up arrow to repeat something long and complicated I did 10 minutes ago. The joke there is sometimes that takes too long too. So that’s wherehistory | grep 'keyword'is niceYou may enjoy
ctrl + r. It hasn’t completely replaced grepping history for me but it’s close.If you trigger fzf with ctrl-r then you might never need to grep again.
If it’s bash, it’s using readline, which is in emacs-like mode by default, and so you can probably use Control-R to do a reverse i-search (incremental search). Enter to invoke the command. Control-C to abort i-search.
If a search matches multiple candidates, tap Control-R multiple times to cycle back through results.
EDIT: Also,
!has a built-in search, so if you are sure of the starting string, you can just do that. I generally prefer to use the interactive search to confirm that I’m not invoking something wonky.Never again, lol.
Last time I did that, it was not what I remembered. I didn’t break anything, but it was close enough that I scared the shit out of myself.