June 13, 2013

Do you want unlimited history in Linux Terminal?

History in Linux terminal is very usefull if you get used to it. If you have to ssh long hostname, or long  file paths you don't need to type them again and again. You can just grep your history and rip what you want like this.

Lets say I want my ssh commands I want to get.
history | grep ssh
perhaps may be smbclient commands
history | greb smbclient
By default in Ubuntu Linux History size is 2000 commands or some thing like that. That will limit you from accessing your all commands. Then you may feel sick of using history. Solution for that is making you linux terminal history unlimited. Those days disk space is not much concern so you can save your all the history in single file without any problem. For 7000 commands it will not take half of a Mega Byte at least. Lets see how to make this history unlimited.

1. Take a terminal and type below command.
gedit ~/.bashrc
or
vi ~/.bashrc
2. Then find  below lines from gedit or vi
HISTFILESIZE=2000 
HISTSIZE=2000 
3. Change delete the number infront of equal.
HISTFILESIZE= 
HISTSIZE=
4. Save it.
5. Close and open a terminal again.

3 comments: