[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: can't the shell do a better job



on Sat, Jan 01, 2005 at 02:52:12PM +0800, Smith a (sqrt_3@hotmail.com) wrote:
> when i am in command line , i often use up arrow key to get commands used 
> before, but if i have used a command several times,  the up arrow key will 
> display the same command several times, this is not welcome.  
> ~/.bash_history contains the commands used before, can the shell display 
> the same command just once?

Sure, but reverse-search-history is probably what you want:

   C-r<string>

...recalls the most recently occuring line matching <string>.


Repeating the C-r (that's <ctrl>-r BTW) finds the next prior match.


Very useful that.  I'd actually used bash for a few years before having
it pointed out to me.


Peace.

-- 
Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
    My nation is silent right now.
    - Sri Lankan survivor of Indian Ocean tsunami.
      Please help:                  http://www.google.com/tsunami_relief.html

Attachment: signature.asc
Description: Digital signature


Reply to: