Linux Certification, System Administration, Programming, Networking Books
How to Clear History

Is there any method to clear history other than delete the contents of .bash_history in linux 7.2.
If there is any plz tell me.

First note that deleting .bash_history will _not_ remove history.
When bash starts it loads the history into memory and writes it back to the file when it exits.

You can set the HISTSIZE environment variable to limit the number of lines of history.
Set it to 0 to clear history.

$ export HISTSIZE=0

The HISTFILESIZE variable controls the number of history written to bash_history. If you do

$ export HISTFILESIZE=0

you will get history in the current session but it will not be written to disk.

BTW you probably mean Redhat 7.2 not linux 7.2

----------------------------------------------------------------------------------------------------------------------------

Use the command
$history -c

This will clear the history

Quick Links:
Do you have a Linux Question?

Linux Home: Linux System Administration Hints and Tips