Linux / UNIX: Clear bash history

by Vivek Gite on October 15, 2007 · 10 comments

Q. I'm using CentOS Linux server and how do I clear bash history in UNIX / Linux / BSD operating systems?

A. Type the following command to clear your bash history:

>~/.bash_history

Another option is link ~/.bash_history to /dev/null:
ln -sf /dev/null ~/.bash_history

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 10 comments… read them below or add one }

1 Rodrigo February 17, 2009

Hi !

The sintax is wrong, it shoud say: ln -sf /dev/null ~/.bash_history or else you would be pointing /dev/null to bash_history

great site !!!

Reply

2 Vivek Gite February 17, 2009

Thanks for the heads up!

Reply

3 jack March 12, 2009

1) Another option is link ~/.bash_history to /dev/null:
ln -sf /dev/null ~/.bash_history

2) The sintax is wrong, it shoud say:
ln -sf /dev/null ~/.bash_history

both these look identical to me!
tell u what tho, it is syntax and NOT sintax ;)

Reply

4 Sorin Roiban May 27, 2009

history -c

Reply

5 kittu October 24, 2010

u rock man…………….

Reply

6 Partha May 22, 2011

Its great yaar. command working cool.

Reply

7 Pinoy July 5, 2011

history -c works! Thanks

Reply

8 Franco Springveldt April 7, 2010

So simple!

Reply

9 Vkram August 4, 2011

ln -sf /dev/null ~/.bash_history
It is also good
but why take long, When there is already shortcut
history -c
Best Command

Reply

10 Ashok October 14, 2011

Simply use bellow command to clear history

>history -c

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 12 + 15 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: