How to clear ZSH history of commands executed on Mac Terminal

If you want to remove all the previous history of the commands that you may have executed on your Mac Terminal, you can do that by following the below commands.

% rm ~/.zsh_history

Careful with the below command, it will remove all sessions history!

% rm -r ~/.zsh_sessions

Restart your Terminal and all the history will be gone!

Both the .zsh_history file and .zsh_sessions directory will get re-created as you execute commands on the console.
Remove ZSH History Commands

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap