Search This Blog

Sunday, April 26, 2020

Using set command for temporarily disabling shell history

set is used to change the value of shell attributes and positional parameters, or display the names and values of shell variables.

If you are executing a command which contains your password or some other sensitive details and you don't want it logged in command history you can turn off history logging by

$ set +o history

To check whether history is turned off you can execute
$ set -o | grep history
history         off

You can turn it back on by executing 

$ set -o history