History | grep "keyword2find" does not gives unlimited history
By default history command, which uses ~/.bash_history
file to store command, store only last 2000 commands. So, It doesn't give you unlimited result.
To increase the size, open .bashrc file with this command gedit ~/.bashrc
and change the line to increase value
HISTSIZE=1000
HISTFILESIZE=2000
HISTSIZE
refers to the number of commands stored.HISTFILESIZE
refers to the number of line contained in the history file.
Use history number | grep keyword the number here refers to how many previous history should be fetched. Example: history 500
will fetch last 500 command of your bash history.
To extend your bash history recording add the below lines to your .bashrc file.
export HISTSIZE=9000
export HISTCONTROL=erasedups
First line tells how many history lines should be recorded.
By using the second line you can avoid duplicate history lines.
Also, to search the history easily you can use Ctrl+R which give a prompt like ! Where in you can type the keyword which you would like to search.
How this helps.