Disable and Clear Linux Command History

When you type commands in the bash shell, the shell by default is recording every command that you input via the terminal

You can see the previously entered commands by using the up and down arrows on your keyboard or you can see a list of all the previously entered commands by issuing the history command

The command history poses a privacy and security risk.
You can clear the command history by using the history -c command
the command history is stored in ~/.bash_history file so removing that file will also clear the history.

If you want to permanently disable history logging in Linux than you can setup the HISTSIZE variable to zero in /etc/profile

HISTSIZE i.e. the history size controls the number of entries which are stored in the command history buffer, so setting this to zero will just disable the terminal command history.

Leave a Reply