Last Updated: February 25, 2016
·
299
· dissolve

Never forget a bash command again.

Always forgetting what that command was you used to run? The default history only goes back 1000 entries. Bash history is just a text file (.bash_history) so why not store more. A lot more.

Edit your .bashrc or .bash_profile and add in

export HISTSIZE=100000
export HISTFILESIZE=10000000

HISTSIZE is the number of lines allowed in the file, while HISTFILESIZE is the limit to the physical size on disk. Now your history goes back 100,000 entries. But is that a bit too much to look through, well yes, but just a quick grep and you can find anything pretty easilty.

history |grep -i something

Remember to run

source .bash_profile

if you don't restart bash. This will bring in those changes you just made.