Skip to content

Instantly share code, notes, and snippets.

@Angles
Created August 6, 2012 11:03
Show Gist options
  • Save Angles/3273505 to your computer and use it in GitHub Desktop.
Save Angles/3273505 to your computer and use it in GitHub Desktop.
HISTIGNORE what's the deal
###
####### HISTIGNORE #######
###
# examples from interwebs, noob dot file notes
#export HISTIGNORE='pwd:exit:fg:bg:top:clear'
# (if try to erasedups do not ignore things want 2 pune but on OSX it no workie)
# ignore things that start with a space, and ignore the exit command
#HISTIGNORE='[ \t]*:exit'
# some slashdot dudes says
#export HISTIGNORE="&:ls:[bf]g:exit:pwd:clear:mount:umount:[ \t]*"
#if the extglob option is enabled, you can also use extended patterns, e.g.
#HISTIGNORE='a*( )'
# The '&' suppresses duplicate entries.
# various examples
# HISTIGNORE="&:exit:ls:lo:x:y:history"
#HISTIGNORE="&:exit:x:history"
#HISTIGNORE='&:exit:x:h:history'
#HISTIGNORE='&:exit:x:h:l:history'
#HISTIGNORE='&:exit:x:h:l:history'
#HISTIGNORE='&:exit:x:h:l:m:history'
# problem "h search" not ignored.
# THE ISSUE IS THE EXACT MATCH, SPACE AFTER IT IS NOT AN EXACT MATCH
#
# some more various examples
# some slashdot dude says
# "Don not save trivial one and two character commands on the history list"
#HISTIGNORE='?:??'
# works for exact one and 2 letter cmds
# add a space and params, they no longer match, are not ignored
# Same dude says he uses
#HISTIGNORE=' *:&:?:??'
# note syntax his version of leading space cmd ignore
### another example from thayer.bashrc
# ignore commands, ls, bg and fg, and exit
# HISTIGNORE='\&:fg:bg:ls:pwd:cd ..:cd ~-:cd -:cd:jobs:set -x:ls -l:ls -l'
## (forget this for now) HISTIGNORE=${HISTIGNORE}':%1:%2:shutdown*'
# he puts exact "ls -l" not just "ls" and "shutdown*" only one with * wildcard
#
# some more various examples
#HISTIGNORE='&:exit:x:h:l:history:[ \t]*'
#HISTIGNORE='&:exit:x:l:history:[h ]*:[ \t]*'
# use that leading space ignore thing the slashdot guy uses
#HISTIGNORE=' *:&:exit:x:l:history:editenv:[h ]*'
# use the ?:?? "ignore trivial 1 and 2 letter cmds" (with no switches or spaces after)
#HISTIGNORE='&:exit:x:l:history:editenv:?:??:[h ]*:[ \t]*'
# very broad, pressing up arrow and re doing a cmd, it not there
# what of [ \t]* that TAB? must b elite to start off with tab, put it back
HISTIGNORE='&:exit:x:l:history:editenv:[h ]*:[ \t]*'
export HISTIGNORE
# some various examples
# done for now
@vitaly-zdanevich
Copy link

@vitaly-zdanevich
Copy link

ignore things that start with a space, and ignore the exit command

Use:

HISTCONTROL=ignorespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment