Unlimited Bash History


By: variia

January 22, 2009 10:21 am





The shell history is a very useful tool for system administrators perhaps for any other user as well. I found on some custom systems that I need unlimited history to actually track what was happening on the machine for its lifetime particularly for the root account.

The default settings in bash to remember are 500 lines and 500 commands, I reckon that’s very small and after this your history gets truncated.

The solution is to make it very large through the shell profile settings:

geeko:~ # vi .bashrc
declare -x HISTFILESIZE=1000000000
declare -x HISTSIZE=1000000

It’s technically not unlimited, just large enough to keep you running for a while 🙂 But in reality you have very little chance to fill this history…

Activate it by logout/login or just source it for your current session:

geeko:~ # source .bashrc
0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Tags: ,
Categories: Enterprise Linux, Technical Solutions

Disclaimer: As with everything else in the SUSE Blog, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.