Save Gnome Terminal history


I noticed that when I exited the GNOME Terminal, the commands that I entered were gone. How do we save the commands in the Terminal history? I want to access it even after shutdown or reboot.



If you use bash then the history will be saved on your ~/.bash_history file. If you use zsh then all will be in your ~/.zhistory

1 Like

Thanks for taking the time to answer.

I actually read that link before posting but there are some commands that didn’t work like the one below. I am also not familiar with some of the topics there.

stat .zsh_history
stat: cannot statx ‘.zsh_history’: No such file or directory

I went to the / directory and it’s the same error.
I also don’t have that .zhistory.

I ran echo $HISTFILE and it was blank. Like just a new line with nothing in it.


And below command didn’t work:

stat $(echo $HISTFILE)
stat: missing operand

I do have the /usr/share/zsh/manjaro-zsh-config and I found these inside the file:


I also have those settings in /usr/share/zsh/manjaro-zsh-config as suggested by user bluerain

setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one

What I wanted is after reboot or after closing the Terminal window, I can still look and execute the previous commands that I entered.