Ubuntu – How to change history size for ever

command line

The default size of history in Ubuntu is 1000 but it's too small. I want to change it to 10000, So I append

export HISTSIZE=10000
export HISEFILESIZE=10000

to .profile
and 'source' it

source .profile

then I run

echo $HISTSIZE
echo $HISTFILESIZE

1000 was displayed for both but I reboot my computer it went 'default'.
Why doesn't it work?

Best Answer

I tried the same thing, only to discover that sneaky Ubuntu sets these variables in ~/.bashrc by default, which is executed instead of ~/.profile for non login shells such as just opening a terminal window. Changing these lines in ~/.bashrc fixed it for me:

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