Use HISTIGNORE in bash
By dylunio on 05 Jul 2006
Don't you find it annoying when you have been using the same command in bash a few times in a row, and then you scroll through the history to a previous command only having to go through many duplicates of the command you just used.
For this use bash's HISTIGNORE variable, set in in your ~/.bashrc file.
HISTIGNORE="&"
Will mean you will not have duplicates in your bash history, but you can use other varables too, say you don't want the commands beggining with c to be put in the history.
An example of this together with not having duplicates:
HISTIGNORE="c*:&"









Comments
Great tip! I didn't know
by libervisco | Wed, 2006-07-05 19:30Great tip! I didn't know about that. I do sometimes use one command many times (usually when testing something) and then when I go through history it repeats the same one many times..
I'll try this.
Thanks
Good find!
by waylandbill | Thu, 2006-07-13 15:56I didn't know that variable even existed.
Some programs might
by tbuitenh | Sat, 2006-07-15 15:08Some programs might allow/require a password on the commandline. Put those in histignore too so your password can't be found by reading your history file.
[link removed]
by Anonymous | Tue, 2009-06-09 06:43Don't you find it annoying when you have been using the same command in bash a few times in a row, and then you scroll through the history to a previous command only having to go through many duplicates of the command you just used.
[link removed]