Hi.
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.
Thanks
Hi.
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.
Thanks
Hello,
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
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.
echo $HISTFILE
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:
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
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
HISTFILE=~/.zhistory
HISTSIZE=1000
SAVEHIST=1000
What I wanted is after reboot or after closing the Terminal window, I can still look and execute the previous commands that I entered.