Clear history in zsh
Using the Command Line
In zsh, you can clear the command history by using the following command instead of history -c
:
history -p
Using the Zsh History File
Zsh stores your command history in a file called .zsh_history
. To clear your command history using the history file, follow these steps:
- Open the
.zsh_history
file in your favorite text editor. - Delete all the entries in the file.
- Save the file and exit the text editor.