Linux - How to give commands without logging them in terminal history
This is a brief note, but in my opinion it can be really useful. Sometimes for security purposes is better to avoid saving given commands in terminal history. So I'm going to tell you how we can do it, because the issue is extremaly easy, but not everyone knows that.
What can I do to avoid logging in history?
Please, look at this output:Any command (it will be logged)
$ echo "Another command (it WILL NOT be logged)"
Another command (it WILL NOT be logged)
$ history | tail -n 2
2003 echo "Any command (it will be logged)"
2004 history | tail -n 2
As we can see, the second echo command has not been saved in the terminal history. So what is the difference from the first one? Maybe it is not obvious, but the second echo command is preceded by the single spacebar! And this is the key! So when we don't want to be logged in terminal history we have to precede commands by single or multiple spacebars.
Komentarze (0) - Nikt jeszcze nie komentował - bądź pierwszy!