Execute a command without saving it in the history

Categories General Info

‘spacebar’ command
This is sample output – yours may be different.

$ echo this goes to history
this goes to history

$ echo this wont go to history
this wont go to history

$ history
1 echo this goes to history
2 history

Prepending one or more spaces to your command won’t be saved in history.
Useful for passwords on the commandline.
Tested on BASH.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.