Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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\$ (\!) '
export HISTIGNORE="[   ]*:&:bg:fg:exit"
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
share|improve this question
Show us how you setup your prompt in your bash init file. –  Kyle Jones Feb 27 '12 at 2:09
Also please show wc -l ~/.bash_history –  bdowning Feb 27 '12 at 11:58
add comment

1 Answer

I may have a working theory on this.

Previously I had


However actual lines in ~/.bash_history appear like

wizmo reboot!
sc stop uxsms; sleep 1; sc start UxSms

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.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.