Look, I'm lazy, okay?
Look, I'm lazy, okay?
history | grep ‘command’
I use this all the time. Even better if you add it as a function.
hgrep
hists for ‘history search’. Interesting how we came up with different names for the same thing.
This is my approach, and for those who don't know, you can use those line numbers that come back from history to rerun the command. Like if your output is something like this:
$ history | grep tmp
501 ls /tmp
502 history | grep tmp
You can run !501 and it will just re-run ls /tmp
Ctrl+R
Then type any part of the command (filename, search string, etc)
Ctrl+R again to cycle through the matches.
(Best feature in bash)
history | grep ‘command’
I use xonsh, which has decent history - start your command, and up arrow cycles through commands stating with what you typed.
There’s good stuff and bad stuff about xonsh.