Red Hat Bugzilla – Bug 500819
RFE: add HISTCONTROL="ignoreboth" to /etc/bashrc or /etc/profile
Last modified: 2009-05-20 08:36:57 EDT
.bash_history currently keeps all the duplicate entries if you for example type the same line twice. That's annoying when you search through the history.
By exporting HISTCONTROL="ignoreboth" duplicates and lines starting with a space will be ignored.
It would be nice to have this as default for every user so I'd suggest to add this to the appropriate place (/etc/bashrc or /etc/profile or what else suits)
excerpt from "man bash":
A colon-separated list of values controlling how commands are
saved on the history list. If the list of values includes
ignorespace, lines which begin with a space character are not
saved in the history list. A value of ignoredups causes lines
matching the previous history entry to not be saved. A value of
ignoreboth is shorthand for ignorespace and ignoredups. A value
of erasedups causes all previous lines matching the current line
to be removed from the history list before that line is saved.
Any value not in the above list is ignored. If HISTCONTROL is
unset, or does not include a valid value, all lines read by the
shell parser are saved on the history list, subject to the value
of HISTIGNORE. The second and subsequent lines of a multi-line
compound command are not tested, and are added to the history
regardless of the value of HISTCONTROL.
Thanks for suggestion, as it is default in Gentoo/OpenSuSe/Debian/Ubuntu, I'll change this that way in RAWHIDE as well - as I think distro consolidation is good thing. Changed in setup-2.8.5-1.fc12, closing RAWHIDE.