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:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 10 comments… read them below or add one }
Hi !
The sintax is wrong, it shoud say:
ln -sf /dev/null ~/.bash_historyor else you would be pointing /dev/null to bash_historygreat site !!!
Thanks for the heads up!
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 ;)
history -c
u rock man…………….
Its great yaar. command working cool.
history -c works! Thanks
So simple!
ln -sf /dev/null ~/.bash_history
It is also good
but why take long, When there is already shortcut
history -c
Best Command
Simply use bellow command to clear history
>history -c