TROMjaro Forum

Clearing terminal history

How can I how erase the history of my commands in xfce4-terminal?

I think it has a reset option in the menu, See if that works.

No, I’m afraid the history is still there.

Type in terminal history -c

Already tried that, it gives this message:

history: bad option: -c

TROMjaro has moved from bash to zsh for our terminal, so the equivalent to history -c on zsh is history -p. But do note that this command will only clear the history for your current terminal session. Your command history is stored in a file called .zsh_history at your home directory (in file managers you have to enable “show hidden files” to see files starting with a dot). So if you want to permanently delete your command history then you just have to remove the contents of that file, there are different ways to do this but you can just use this command:

truncate -s 0 ~/.zsh_history

Or if you only wanna remove certain commands from your history then you can edit that file with a text editor. Also one other thing to note is that commands starting with a space won’t be saved in your history, so if there is a sensitive command you don’t want to be saved in history then just precede it with a space before typing it on your terminal.

2 Likes

Thank you so much for this very complete answer.

2 Likes