[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 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?

Add the following to the .bashrc in you home directory:

export HISTCONTROL=ignoreboth

Look at the bash manual for more options to HISTCONTROL.

You need to logout and login again for this to take effect. 

Somewhat related: with CONTROL-R you can search backwards in your
history when on the command line. It can be quite a time saver. I
think that's only when you're in emacs-compatible mode.


Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key: keyserver.net ID 0x1735C5C2
"Let your advance worrying become advance thinking and planning."
 - Winston Churchill

Attachment: signature.asc
Description: Digital signature

Reply to: