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

Re: .bash_history



> On Wed, 14 Jul 1999, Patrick Kirk wrote:
> 
> > Hi all,
> > 
> > I love the ability to get at previous commands just by flicking the up 
> >arrow.  But if the last 15 commands were mutt, its a little less
> >conenient.  Is there a way that if the last 15  commands were ls preceded
> >by 10 mutts amd preceded by three tops, then the uparrow would first show
> >ls, then mutt and then top?
> > -- 
> > Patrick Kirk
> > 

	If I understand you correctly, you only want to hit the up arrow
three times to get to top rather than 25 times.  One way is to tell bash not
to store seqential duplicates of a command.  Put this in your bash environment:

	export HISTCONTROL=ignoredups

With that, if you do 15 'ls -l', 10 'mutt' and 3 'top', all your history
file will retain is 

...
<whatever>
<whatever>
<whatever>
<whatever>
<whatever>
<whatever>
ls -l
mutt
top
<whatever>
<whatever>
<whatever>
...

However, this works on the whole command line, not just the command name. 
Thus, if you do 7 'ls -l', a 'ls -sAF', 7 more 'ls -l', 9 'mutt', a 'mutt
-R', and 3 'top', your history file will retain

...
ls -l
ls -sAF
ls -l
mutt
mutt -R 
top
...


HTH,

G.


Reply to: