0

I've read these two questions and the accepted answers on StackOverflow:

However, I still don't understand why in any bash session I can see this

$ echo $HISTSIZE 
1000000
$ echo $HISTFILESIZE 
10000000
$ wc -l $HISTFILE
3822 /home/enrico/.bash_history
$ history | wc -l
1914

where the last two numbers are just... low! And indeed, the history in which I can search for past commands is that short, which means close to useless.

And this is not just now that I write the question! Basically history | wc -l and wc -l $HISTFILE have always been that low since I have memory of this system, which I bought in summer 2020. Probably I've misconfigured something in the early days...?

If it is of interest, these are the only lines from my ~/.bashrc that match hist case insensitively:

HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000000
HISTFILESIZE=10000000
    history -a # this is in a function that is assigned to PROMPT_COMMAND
shopt -s cmdhist
shopt -s lithist
HISTTIMEFORMAT="%d/%m/%y %T "

Other info:

$ ls -l .bash_history 
-rw------- 1 enrico enrico 59833 Feb 19 18:57 .bash_history

The system in question is mine personal, there's no admin but me (and I'm not knowledgeable for an admin, as you see), and I'm using this system since summer 2020. Nonetheless

$ stat -c '%w' .bash_history
2021-02-05 18:53:22.365436127 +0000
11
  • Is it a new system? Have you modified the parameters recently? On my system echo $HISTFILESIZE is equal to wc -l $HISTFILE – Arkadiusz Drabczyk Feb 19 at 18:06
  • No, I've been using this system everyday for one year at least :/ – Enlico Feb 19 at 18:07
  • What OS? Does your .bash_history have a creation date? – Andrew Henle Feb 19 at 18:17
  • @AndrewHenle, Archlinux. If stat -c '%w' .bash_history is the way to answer your second question, then I have no idea why it shows 2021-02-05 18:53:22.365436127 +0000, as I use bash everyday, and not since just 2 weeks ago. – Enlico Feb 19 at 18:23
  • Something deleted your .bash_history file, and it was recreated at that date and time, probably the first time you logged out or otherwise ended a bash session after the file was deleted. Have you annoyed one of your system administrators lately? ;-) – Andrew Henle Feb 19 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.