Bash trick: using grep for faster history search
Bash trick: using grep for faster history search
October 18, 2025
Dmitri had a nice tip search your bash history. Add the following alias to the .bashrc file:
alias hist='history | grep --color=auto'
Say, you want to find a previously used rsync command. In the terminal, run hist rsync
, and you should see a list of all matching commands saved in the .bash_history file. To run the desired command, use !000
, where 000
is the command’s number.