Tuesday, August 07, 2007


Shell Command History Size

A small tip for those who use the command line a lot - add the following to your ~/.bashrc:

export HISTSIZE=9999
export HISTFILESIZE=999999
The value of the HISTSIZE variable determines the number of events preserved in the history list during a session. When you exit from the shell, the most recently executed commands are saved in the file given by the HISTFILE variable (the default is ~/.bash_history). The next time you start the shell, this file initializes the history list. The value of the HISTFILESIZE variable determines the number of lines of history saved in HISTFILE (not necessarily the same as HISTSIZE). HISTSIZE holds the number of events remembered during a session, HISTFILESIZE holds the number remembered between sessions, and the file designated by HISTFILE holds the history list.

Even modern linux distributions set the values for these commands to a low value like 1000. In current world, storing a few 100 kB of history file on disk is nothing. All linux distributions should therefore change the defaults. Till then, add the above mentioned code to your ~/.bashrc and never type the same command twice (instead search using Ctrl + R).

Labels: ,

Thank you :)
This comment has been removed by a blog administrator.
When you said "Never type de same command twice", there is another useful way adding:

export HISTCONTROL=ignoredups

I found at:
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?