Is there any way to exclude commands like rm -rf, svn revert from being getting stored in bash history? Actually I, by mistake, have issued them a number of times even though I have no intent to do, just because I am doing things quickly and it happened. Hence results in lost of lots of work I have did so far.
|
|
|||||
|
|
You might want
Also, you can add a space at the beginning of a command to exclude it from history. This works as long as |
|||||
|
|
I usually kill my bash-instance when I have done things that I don't want in the history.
$$ represents the current process - bash when you run it from the shell. You can use $BASHPID, but that's more typing :-) |
|||
|
Though going slightly different from OP's question, when I intentionally don't want a command to get stored in bash history, I prefix them with a space. Works in Ubuntu and its variants, not sure if it works on all systems. |
|||