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 .

foxtrot9
  • 557
  • reference for this environment variable: http://askubuntu.com/questions/624848/view-history-of-commands-ran-in-terminal?noredirect=1&lq=1 – foxtrot9 Jul 24 '16 at 09:55

1 Answers1

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.

heemayl
  • 91,753