2

As this question suggest that bash keeps last 500 entries in history. But following command suggest otherwise,

$ echo $HISTSIZE
1000

I have never changed bash history settings or config files other than to edit path variables. I am using Ubuntu 14.04 amd64 .

3

If HISTSIZE environment variable is not set in any startup configuration file of bash, it will be set to 500. From man bash:

The shell sets the default value to 500 after reading any startup files.

The HISTFILESIZE follows HISTSIZE, if not set.

Now, you are getting the value of HISTSIZE as 500 because Ubuntu by default sets the HISTSIZE (and HISTFILESIZE) environment variables to the following values in your bash runtime configuration file (the file that will be source-d when a new interactive shell instance is started), ~/.bashrc:

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)                                                                                                                     
HISTSIZE=1000
HISTFILESIZE=2000

To be sure, read the .bashrc skeleton file, /etc/skel/.bashrc; It is copied to each newly created user's bash runtime configuration file, ~/.bashrc.

  • Yup ~/.bashrc contains HISTSIZE=1000 and HISTFILESIZE=2000. – foxtrot9 Jul 24 '16 at 10:00

Your Answer

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

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