Bash trick: using grep for faster history search
Here's a neat little trick that makes it easier to find a specific command in the 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.