Hacker News new | ask | show | jobs
by ams6110 3361 days ago
See the HISTCONTROL environment variable in bash (and maybe something similar in other shells):

    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.
        [...]
This is convenient because any time you don't want a command saved in history, just start it with a leading space.

Also look at HISTIGNORE for finer grained control.