Sometimes, you may have to disable the Linux history, which is not a difficult task. We can do this with the help of the “set” command. Please follow the steps given below.
The set command is an inbuilt bash command, and you can use this command to set or change the bash shell environment.
“set -o” will give you the list of features and the status.
-bash-4.3# set -o allexport off braceexpand on emacs on errexit off errtrace off functrace off hashall on histexpand on history on ignoreeof off interactive-comments on keyword off monitor on noclobber off noexec off noglob off nolog off notify off nounset off onecmd off physical off pipefail off posix off privileged off verbose off vi off xtrace off
As you can see, the “history” status is “on”, which is why it records everything you type. Let’s disable history Linux.
To disable an option, you can use the command given below.
set +o
If you want to enable it later, you can use the command given below.
set -o
In this case, we can go to disable the “history”.
-bash-4.3# set -o | grep history history on -bash-4.3# set +o history -bash-4.3# set -o | grep history history off
See! It’s “Disabled”!
If you want to enable it again, type the following command.
set -o history