Bug 500819

Summary: RFE: add HISTCONTROL="ignoreboth" to /etc/bashrc or /etc/profile
Product: [Fedora] Fedora Reporter: Stefan Assmann <sassmann>
Component: setupAssignee: Ondrej Vasik <ovasik>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: mosvald, ovasik, pknirsch, xalt7x.service
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: setup-2.8.5-1.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-20 12:36:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Assmann 2009-05-14 11:44:05 UTC
.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":
       HISTCONTROL
              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.

Comment 1 Ondrej Vasik 2009-05-20 12:36:57 UTC
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.

Comment 2 Yevhen Popok 2023-11-05 18:14:19 UTC
Dear maintainers,
I've found that the change asked here was applied and later reverted (https://bugzilla.redhat.com/show_bug.cgi?id=520632).
I believe that "ignoreboth"/"ignorespace" is a good default that is still provided by other popular distros (Ubuntu, Debian, openSUSE).
It's also expected by KDE utilities with built-in terminals that register directory navigations using cd with leading space (e.g. Kate, Dolphin).
Is it possible to re-introduce this change to improve default user experience?

Comment 3 Red Hat Bugzilla 2024-03-05 04:25:02 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days