I'm trying to clear the history of commands that have been run on Terminal, I found an article which said I can do it with
However, I am still able to see the previous commands that I've ran by pressing the up arrow
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
If you are running
zsh, you'll need to use this command to clear the Terminal history:
Alternatively, you can open your user folder in Finder, press Command + Shift + . to show all files, and manually drag the hidden
.zsh_history file to the trash.
You might also want to check and clear the
.zsh_sessions folder too, as it also might contain the history of previous Terminal sessions.
So what you have to do is:
Hope this helps!
None of these worked. History is deleted, yet every time I re-opened terminal, I still had access to my command history. It's a security risk, and the only indication you get is in case you cleanly exit a session: "Saving session... ...copying shared history... …saving history...truncating history files... ...completed."
The full answer is this: https://www.swiftforensics.com/2018/05/bash-sessions-in-macos.html
The history still gets saved to ~/.bash_history and recalled every time.