Skip to content

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:

  1. Open the .zsh_history file in your favorite text editor.
  2. Delete all the entries in the file.
  3. Save the file and exit the text editor.
Feedback