# fuzzy find in your terminal history 2024-08-13T11:55:44Z Yeah, I know, Ctrl-R, right? But it only show the very last match, and I feel sometimes confused when I look for long commands. That's why I wrote this litle alias to add in your shell config (''~/.aliases''): ``` alias hf='fc -l 1 | cut -f2- | pick | ${SHELL:-"/bin/sh"}' ``` Now, when I enter ''hf'', I see all commands recorded in history. That's what ''fc -l 1'' do : showing all comands from the first. Then, ''cut'' remove the first field, to only see the command. ''pick'' let me choose the command to re-run, and it's finally piped to a new shell. Of course, you may replace pick by similar tools such as: => https://pedantic.software/git/choice => https://github.com/jhawthorn/fzy => https://github.com/junegunn/fzf Now I wrote this, I can read in the pick manpage this : ``` Select a command from the history to execute: $ eval $(fc -ln 1 | pick) ``` Seems like I should have read it before :) So, now, it's : alias hf='eval $(fc -ln 1 | pick)' --- Comment? => mailto:bla@bla.si3t.ch?subject=fuzzy-find-terminal-history See instructions: => /log/_commentaires_.txt