I noticed that my .zhistory file doesn’t have the older commands I gave. It is just a 4.1KB file usually and has around 200lines after noticing the same repeating over some time. This really bugs me. As I always mess up trying to do somthing, this was a reliable source for me to trace my steps.The bashhistory was reliable in this manner( when I was on Ubuntu.)
I use a gnome-terminal on manjaro gnome DE.
My zshrc is at the default configuration.
Is there any way I can prevent this from happening?
Hi @Korosensei, and welcome!
I use ZSH myself and I am unable to find a .zhistory file. However, I did find ~/.zsh_history which is the gistory file, it seems. Might this also be the case there? Otherwise, it might be permissions, so here’s my history file’s permissions:
$ stat .zsh_history
File: .zsh_history
Size: 13606 Blocks: 32 IO Block: 4096 regular file
Device: 10302h/66306d Inode: 5243630 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/mirdarthos) Gid: ( 1000/mirdarthos)
Access: 2021-01-05 14:04:34.776337102 +0200
Modify: 2021-01-05 14:07:58.632729466 +0200
Change: 2021-01-05 14:07:58.632729466 +0200
Birth: 2021-01-05 14:04:34.776337102 +0200
I hope this helps.
Thanks for the reply. Actually I have got a bash_history file.
But the history files I got goes to .zhistory. I haven’t got the .zsh_history in /home.
I just checked again found and found ~/.zhistory. So it’s obvious that it was my mistake, not yours.
Double check that the $HISTFILE environment variable exists and is correct.
echo $HISTFILE
Then check if the file exists and it’s permissions are correct:
$ stat $(echo $HISTFILE)
File: /home/mirdarthos/.zhistory
Size: 12086 Blocks: 24 IO Block: 4096 regular file
Device: 10302h/66306d Inode: 5285510 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/mirdarthos) Gid: ( 1000/mirdarthos)
Access: 2021-01-13 08:56:31.657668465 +0200
Modify: 2021-01-13 09:11:08.767260716 +0200
Change: 2021-01-13 09:11:08.767260716 +0200
Birth: 2021-01-13 08:56:31.657668465 +0200
Edit:
I just found this page regarding zsh history. According to that:
History accepts a range in zsh entries as
[first] [last]arguments, so to get them all runhistory 0.To get the zsh help (at least with mind) type
Alt-hover the history command and this will bring up the help for built-ins.
Thank you for reporting, I will look into this and try to fix it.
Have tried one:
But unfortunately does not make nice linebreaks for longer command lines
doesn’t really seem to be a bug, more a function of zsh
See accepted answer:
I might be lost as lost as Alice here, but wouldn’t enlarging HISTSIZE and SAVEHIST from current values of 1000 and 500, to something like 10000, be kind of a solution to this?
I try to implement that and ask @Chrysostomus if He agree it
have done your suggested changes, but I think they need some testing
Can tested here:
$ git clone -b 0.20 https://gitlab.manjaro.org/packages/community/manjaro-zsh-config.git
$ cd manjaro-zsh-config
$ makepkg -si
Thank you, already testing it. But my .zhistory it’s at 600 entries yet, so it may take a while…
Okay, approval and push to master needs to be done by @Chrysostomus anyway.
So we will see…
In unstable
Any update to this? I’m also seeing a ‘short’ history under zsh and Gnome.
It’s already there if you have your system updated, with latest manjaro-zsh-config. My .zhistory is over +2000 entries already, up to the potential 10K new limit.
This is my current version:
Is there something I need to enable to have the updated entrees kick-in?
I don’t think so. It should already be sourced from your /usr/share/zsh/manjaro-zsh-config, where if you look inside, you should see the new values
HISTSIZE=10000
SAVEHIST=10000
If you still wanna be sure, you can source them manually in your .zshrc, or maybe use other different values.
That’s because in zsh, unlike in bash, the default history command it’s effectively like history -15 or so, to show last 15 entries.
history 1
Try that one instead. That’s like show all entries since first one.

