Skip to main content
To clear all history in Linux, use either one of the following commands:
history -c                        # Clear the current session history
cat /dev/null > ~/.bash_history   # Clear the history file
Additionally, you can use export HISTSIZE=0 to set the history size to zero, which will prevent any commands from being saved in the history file.
If you want to ensure that history is cleared for all users, log in as the root user and clear the history files for each user in the /home directory.

Build docs developers (and LLMs) love