View Single Post
  #1 (permalink)  
Old 29-11-2009, 10:31 PM
jaysunn's Avatar
jaysunn jaysunn is offline
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 604
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default Reverse Search For Bash History

Hello My friends,

Not sure if you were aware of this great bash function that I use daily in my job as a linux systems administrator.

This is called "Reverse I Search" this is tremendously useful when a system administrator needs to search for a previously typed command.

e.g.
About an hour ago I typed a command on my mac book pro into my bash terminal. This command was a difficult command to remember that cleared cache on the system.

Code:
excalibur:~ jasonralph$ dscacheutil -flushcache
Now I have typed about 25 other commands since I typed the command above. I know need this command again, and I can't remember the spelling or command name. However I remember that the command started with dsc.

From the terminal I hold ctrl and r. This invokes the reverse search. Next I type the letters that I remember from the command "dsc". Bash will automatically display the command.

Code:
excalibur:~ jasonralph$ 
(reverse-i-search)`dsc': dscacheutil -flushcache
Now press enter to execute the command that the search has found.

Have fun and hope this helps.

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com

Last edited by jaysunn; 29-11-2009 at 11:19 PM. Reason: changed title
Reply With Quote