Re: why does the shell show commands foolishly when I press UP key?
On Nov 8, 2007 11:39 PM, dulev <dusan.vodopivec@pro-ing.co.yu> wrote:
> > I often use UP key to get commands entered previously. The shell show
> > some commands again and again, just because I have used them several
> > times. Can the shell be more smart?
>
> Put in ~/.bashrc
>
> export HISTCONTROL=ignoredups
And for even more command history goodness, try Ctrl-r.
This enables reverse incremental search. Start typing and it will display the
most recently used command that matches what you have typed so far.
You don't have to type from the beginning, you can type something from
the middle or end of the command. For example, if you typed a command
with a -z option, you could type -z and it would come up.
And this is not history related, but it is still useful (in .bashrc):
# enable smart completion features
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# enable command and file completion after sudo
complete -f -c sudo
Cheers,
Kelly Clowers
Reply to: