HISTCMD displays an erratic behaviour, though I never reset it I promise (I checked all my configuration files). As a result I cannot delete the entry containing my password which I inadvertently typed before the prompt. "history -c" apparently did nothing.
alex@Freesia:~$ echo $HISTCMD
916352
alex@Freesia:~$ echo $HISTCMD
931399
alex@Freesia:~$ history | tail
[...]
946443 2020-10-30-12:55history -d 871209
946444 2020-10-30-12:55history | tail
946445 2020-10-30-12:56echo $HISTCMD
946446 2020-10-30-12:56history | tail
alex@Freesia:~$ history -d 946444
bash: history: 946444: history position out of range
My HIST variables:
alex@Freesia:~$ env | grep HIST
HISTIGNORE=?:??
HISTCONTROL=ignoreboth
HISTTIMEFORMAT=%Y-%m-%d-%H:%M
HISTSIZE=2000
HISTFILESIZE=15000
Linux Freesia 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 GNU/Linux
PROMPT_COMMAND
set to something? As for deleting, why don't you just edit$HISTFILE
manually and remove the offending line? – terdon Oct 30 '20 at 12:28env
. – terdon Oct 30 '20 at 12:29~/.bashrc
then they should appear inenv
unless you're not actually using bash or you are not in an interactive, non-login shell. Personally, I set them in~/.profile
since I want them to affect all of my shell sessions but~/.bashrc
should also work. – terdon Oct 30 '20 at 13:02HISTCMD
increases by a constant number a bit higher thanHISTFILESIZE
, (15047 here). Also, follow the links from this post. Is this aboutPROMPT_COMMAND
? – thanasisp Oct 30 '20 at 14:16