Using fzf to Search Bash History
Been mashing bash commands in a mad dash to thrash that crash-inducing bug? We've all been there and then in the aftermath of such a session how do we find that one command that fixed everything?
ctrl+r provides a pretty nice experience when searching through your bash history but I wanted to give an alternative.
I was first introduced to
fzf as a vim fuzzy file finder but learned later that it's uses expand far beyond just vim usage.
fzf is a fantastic little tool for searching.
fzf is even more fantastic when you start piping everything to it.
Here's the command:
cat ~/.bash_history | fzf | sh
cat everything to
fzf which allows us to fuzzy find the command we're looking for and pipe that to
sh to execute.