Christopher Tyler

Bash trick: using grep for faster history search

Dmitri had a nice tip search your bash history. Add the following alias to the .bashrc file:

1
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.

<< Previous Post

|

Next Post >>

#Grep #Bash #Dmitri Popov