source from: http://www.ducea.com/2006/05/15/linux-tips-take-control-of-your-bash_history/
1. Don’t save duplicates:
This is my favorite…
this causes any lines matching the previous history entry not to be saved.
Other options for HISTCONTROL: ignorespace, lines which begin with a space character are not saved in the history list; erasedups causes all previous lines matching the current line to be removed from the history list before that line is saved.
2. Size of the history:
HISTSIZE: The number of commands to remember in the command history. The default value is 500.
You can set this to 0 and disable the usage of the history file.
HISTFILE: The name of the file in which command history is saved. The default value is ~/.bash_history.
HISTIGNORE: A colon-separated list of patterns used to decide which command lines should be saved on the history list.
How do you set these options? Either export them in your environment in your personal bash configuration file (~/.bashrc) or in the global bash configuration file (/etc/bash.bashrc). The name of the configuration files can depend from your Linux distribution and bash version (the ones included are from Debian Linux), but you can always see your particular options using man bash. So, you can add in your configuration files the parameters you want like this:
You will need to restart your bash session in order to activate the settings. You can check if your configuration were entered correctly by typing env at the command prompt. If you donâ€™t see your configuration in the environment variables than you have done something wrong. If you see your configuration option, then all is ok, and your setting is active already.
Note: to my students (Bogdan and Alin) that attend my Linux Sysadmin course, I hope that this responds your question. Let me know if you have any other questions regarding this issue.
Here is a great note by one Digg user: burke
“the most efficent way to search your history is to hit Ctrl R and type the start of the command. It will autocomplete as soon as there’s a match to a history entry, then you just hit enter”