How to run command in bash without saving it in history?
|
|
Add space before command. commands starting with a space do not put in history:
man bash
|
|||||||||||||||||||||
|
|
Also worth mentioning the trick to kill the current login session instead of normal exit (thus not giving a chance to save the history). This is especially useful when you login to a shared a/c, instead of remembering to prefix with a space, you could just end the session by killing it. The simplest way to kill is by running this command:
Pid 0 always refers to the current process's PID, so you are basically sending a deadly kill signal to itself. I also often use this instead of exiting normally, as I often have hung sessions on normal exit, probably due to some misconfiguration. |
|||
|
|
|
Another solution is to set the history file to a directory:
|
|||
|
|