4 ms·
A space before the command stops it from going in your history, though.
by NoodleIncident 13y ago
A space before the command stops it from going in your history, though.
- ewams 13y agois that only for certain distro's because that isnt true on debian: 115 history 116 history (1 space) 117 history (2 spaces) 118 man passwd 119 passwd -a (1 space) 120 history 121 passwd -a (2 spaces) 122 history
- paxswill 13y agoIt's controlled by the HISTCONTROL variable in bash. If it contains 'ignorespace' (or 'ignoreboth' to ignore duplicates as well). Check the man page for more details.
- judk 13y agoAnyone know why this incredible hack was introduced in hr first place? In my entire career this "feature" had only caused annoyance after copy-pasting a command. Why not have a shell command called 'nohist' to wrap a command line?
- puls 13y agoYou can control this with the HISTCONTROL and HISTIGNORE environment variables: http://askubuntu.com/questions/15926/how-to-avoid-duplicate-entries-in-bash-history http://askubuntu.com/questions/15926/how-to-avoid-duplicate-...
- judk 13y agoThank you for providing something of technical value in this conversation.
- dfc 13y agoMuch to my dismay this is not true. By default debian is configured to `ignoreboth` ie dupes and spaces. Like you I also change the debian default for HISTCONTROL. Lines 11-13 of /etc/skel/.bashrc:[^1] # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth [^1]: https://bazaar.launchpad.net/~doko/+junk/pkg-bash-debian/view/head:/skel.bashrc#L11 https://bazaar.launchpad.net/~doko/+junk/pkg-bash-debian/vie... Provenance for /etc/skel/.bashrc: dfc@ronin:~$ dlocate /etc/skel/ bash: /etc/skel/.bash_logout bash: /etc/skel/.bashrc bash: /etc/skel/.profile dfc@ronin:~$ apt-cache showsrc bash |grep ^Vcs- Vcs-Browser: https://code.launchpad.net/~doko/+junk/pkg-bash-debian Vcs-Bzr: http://bazaar.launchpad.net/~doko/+junk/pkg-bash-debian