Similar to the 5000 line limitation problem when first thing in .bashrc I have
export HISTSIZE=10001
and
export HISTFILESIZE=$HISTSIZE
My users do not have ~/.inputrc
files and the system-wide /etc/inputrc
file, unchanged default for Ubuntu 11.10, does not have any history-size
defined. Nor does the readline
man page show any default for it, except implying (0) or unlimited.
Yet every time I login my prompt shows that I have only 5000, despite having added many more unique command lines during my last session, or saving with history -w
without having logged off.
Where is this limitation set and how can I override it?
My prompt and other possibly interesting settings from ~/.bashrc or files it sources:
PS1='\u@\h\w \d,\t\$ (\!) '
HISTCONTROL=erasedups:ignorespace
HISTSIZE=10001
export HISTIGNORE="[ ]*:&:bg:fg:exit"
export HISTFILESIZE=$HISTSIZE
export PROMPT_COMMAND="history -a"
shopt -s histappend
HISTTIMEFORMAT="%Y-%m-%d_%H-%M-%S "
shopt -s histreedit
Example prompt:
master@quant~/dev Mon Feb 27,10:08:29$ (5721)
To answer some comments:
# to unpollute from other concurrent sessions, which previously already truncated file to 5000 at login:
master@ventana~ Mon Feb 27,18:47:35$ (9220) history -w
master@ventana~ Mon Feb 27,18:51:34$ (9220) history |wc
9219 69109 795143
master@ventana~ Mon Feb 27,18:51:51$ (9220) wc -l ~/.bash_history
18442 /home/master/.bash_history
# ignoring timestamps, nominally every other line like #1328201645
master@ventana~ Mon Feb 27,18:51:58$ (9220) grep -vc "^#[0-9]\{10\}$" .bash_history
9222
Best Answer
I may have a working theory on this.
Previously I had
However actual lines in ~/.bash_history appear like
In other words, every other line is a timestamp due to my
HISTTIMEFORMAT="%Y-%m-%d_%H-%M-%S "
shell environment setting.So for a history of 5000 commands, 10000 lines in the file would be needed.
Now I set the limit to HISTSIZE=20001
and finally see my prompt keeping more that 5000 history commands after a fresh new login.