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 "
$ 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