LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   How do I clear history in Linux (https://www.linuxquestions.org/questions/linux-security-4/how-do-i-clear-history-in-linux-211518/)

ibrahimt 07-30-2004 12:26 PM

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

Ankheg 07-30-2004 12:49 PM

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.

rgiggs 07-30-2004 12:51 PM

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--

Sabicas 08-03-2004 12:36 AM

I personally like to set an alias to do this it's always set as...

alias history="rm .bash_history"

liinux 08-03-2004 07:14 AM

use history -c to clear everything

ppuru 08-03-2004 07:20 AM

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.

ibrahimt 08-03-2004 09:44 AM

Thanks all,

all the suggestions worked as explained. I found "history -c " command most straight-forwad. Thaks to everybody once again

IbrahimT

dr.ash 07-14-2009 02:09 AM

Quote:

Originally Posted by liinux (Post 1085541)
use history -c to clear everything

Thanks alot, it's really helpful

win32sux 07-14-2009 02:15 AM

Quote:

Originally Posted by dr.ash (Post 3606905)
Thanks alot, it's really helpful

dr.ash, please don't resurrect dead threads.

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.