Yes, man bash
says:
HISTSIZE - The number of commands to remember in the command history
But there is a Readline
's variable: history-size
Set the maximum number of history entries saved in the history list. If set to zero, any existing history entries are deleted and no new entries are saved. If set to a value less than zero, the number of history entries is not limited. By default, the number of history entries is not limited.
You can set history-size
with HISTSIZE=1000
, bind 'set history-size 1000'
or with the following line in your ~/.inputrc
: set history-size 1000
Examples:
HISTSIZE=1000
bind 'set history-size 0'
echo $HISTSIZE # prints 1000
bind -v | grep history-size # prints set history-size 0
history # prints nothing
bind 'set history-size 0'
HISTSIZE=1000
echo $HISTSIZE # prints 1000
bind -v | grep history-size # prints set history-size 1000
history # prints 13 echo $HISTSIZE\n14 bind -v | grep history-size\n15 history
history-size
available since bash-4.0-alpha
: CHANGES