How do I clear history in Linux
Hello all,
Please can anybody help me with a command to clear history of all the command I ever typed from command prompt in Linux. I share a system with a number of people that access the system with the same username. I wouldn't want somebody to re-execute a command that I had already executed before either by mistake or intentionally. I have tried using "man history" on mandrake 9.1 but did not give me any result. I also searched the web without success. Thanks in advance Ibrahim |
Depends on which shell you use...but the most common is bash, and I believe it is the default... Chances are, anyway.
If you change to your home directory, and do: ls -al You should see a file called: .bash_history That file will contain all (maybe just most, can't remember what the cap is, if any) of the command line history. To clear it, like you want, you can simply delete that file. |
if you use bash, there's .bash_history in your home directory, remove it. if you use another shell, look for a similar file.
--posting at the same time-- |
I personally like to set an alias to do this it's always set as...
alias history="rm .bash_history" |
use history -c to clear everything
|
edit your .bashrc and add
HISTFILESIZE=0 HISTSIZE=0 Of course, you will not be able to use the up-arrow to retrieve your previous command. OR set HISTSIZE to something that will allow minimum exposure. |
Thanks all,
all the suggestions worked as explained. I found "history -c " command most straight-forwad. Thaks to everybody once again IbrahimT |
Quote:
Thanks alot, it's really helpful |
Quote:
BTW, there's a Thanks button attached to every post, for when you are feeling thankful. |
All times are GMT -5. The time now is 08:26 AM. |