Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command

history | grep "keyword2find"

does not gives unlimited history that i typed in the terminal onwards i installed ubuntu. I want to see all of them without a time span.

share|improve this question
Why dont you look at the .bash_history file in the home folder of whatever user you are wanting to look at. – user93329 Sep 28 '12 at 19:09
up vote 2 down vote accepted

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 refers to the number of commands stored.
HISTFILESIZE refers to the number of line contained in the history file.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.