Command-line commands are collected in .bash_history. Fine! But not all. Often I close a terminal and try a day later to find a command with CtrlR, but bash tells me "command not found". Why are some commands stored in history and some not? How can I prevent lost commands? I use OS X 10.10.5.


The history size is controlled by the variables HISTFILESIZE and HISTSIZE (see man bash). The default value is 500.

You must store these parameters in ~/.bash_profile


export HISTFILESIZE=5000
export HISTSIZE=5000

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .