Search your bash history

http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29

Ever wanted to search your bash history for a specific command? Worry no more, reverse-i-search is there to help. If you press Ctrl-R at your bash prompt, you will get the following:

(reverse-i-search)`':

Here you can type whatever you want to search and you will see that bash will present with most recent command that matches your search:

(reverse-i-search)`cat': adb logcat

If you press Enter you just execute it. If you press the arrow keys (or Home/End), you go back to the prompt with the command to edit. Ctrl-R again goes backward to previous match in your history. Ctrl-G exits the search and returns to an empty prompt.

Another handy tool to know :)

Comments

Popular Posts