Terminal constantly missing some history

Often, I use some command in the (GNOME) terminal, quit, and on next launch, I attempt to find the command I used, only to find it’s missing. Sometimes it misses an entire sequence of commands I used, other times might be just a single one. I’m not using 2 terminal tabs at once, and I only quit after the command is completed. What is happening?

Does the echo $HISTIGNORE command print anything?

Nope, prints an empty line…

This could happen if the session terminates abnormally.

  • Use only Ctrl+D or exit to terminate the session.
  • Avoid using graphical window controls or window manager shortcuts to close the terminal window or its tabs.
  • Always explicitly exit the shell before closing the graphical session.
1 Like

The permissions for ~/.bash_history should be

Is the file in your home dir damaged?

Could be this, I’ve always used the close button to quit, I’ll try the command line.

Yeah, stat shows this permission. I can open .bash_history and read its lines, though it’s missing some commands I used.

set | grep -i histsize

A discussion on this problem could be found here

Which shell program do you use? Some shells omit commands with a leading space from history (one use case).