If you're running the command over and over, you might want to use your shell's history ignore feature. Lets say you have secret.server.com that you ssh to, FTP files to, etc. that you don't want any line that mentions secret.server.com saved:
In bash
you would set
HISTIGNORE="*secret.server.com*"
whereas in zsh
the parameter is called
HISTORY_IGNORE="*secret.server.com*"
HISTIGNORE
can contain multiple patterns, separated with colons. HISTORY_IGNORE
specifies a single pattern but the pattern can contain alternatives, separated with pipes. Note that each pattern is matched against the full input line, so you might need to include a *. For example, the following will exclude fortune
from the history, but will store fortune -l
:
HISTIGNORE="*secret.server.com*:ytalk*:fortune"
HISTORY_IGNORE="*secret.server.com*|ytalk*|fortune"
With HISTIGNORE set, nothing matching the patterns you list will be saved to .bash_history
/.zsh_history
and even the up arrow key, which normally recalls your previous command, won't work if it matches your pattern.