How to disable bash shell history in Linux

www‮uttual.‬ri.com
How to disable bash shell history in Linux

The bash shell maintains a history of the commands that you have typed in a file called .bash_history. If you want to disable this feature, you can follow these steps:

  1. Edit the .bashrc file: The .bashrc file is a configuration file that is read by the bash shell every time you start a new session. To disable the bash history, you can add the following line to the .bashrc file:
unset HISTFILE

This will prevent the bash shell from creating or updating the .bash_history file.

  1. Delete the .bash_history file: If you want to completely remove the .bash_history file and erase your command history, you can delete the file using the following command:
rm ~/.bash_history

Keep in mind that this will only disable the bash history for the current user. If you want to disable the bash history for all users on the system, you will need to edit the global bash configuration file, which is typically located at /etc/bashrc.

Created Time:2017-10-28 21:39:02  Author:lautturi