Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 7
    space is how I've always done it. Commented Feb 23, 2012 at 15:31
  • I used to accidentally enter additional y, after all cp (aliased to cp -i) get over. So I aliased y as alias y='$(history | awk '"'"'END{if(NF==2 && $2=="y"){print "history -d " $1}}'"'"')' ... But HISTIGNORE is better method as it looks. :) Thanks. Commented Nov 22, 2013 at 13:02
  • 2
    Just to be more explicit: you can add export HISTCONTROL="ignorespace" to your ~/.bashrc to ignore commands that start with spaces. Commented Jun 12, 2016 at 2:20
  • @AidanFeldman not default on macOS Commented Oct 12, 2017 at 16:28
  • NOTE: space should be included when we type in the commandline and not in HISTIGNORE. Commented Mar 27, 2018 at 5:58