Friday, January 20, 2012

Clearing Terminal history (Ubuntu)

Terminal history can be a nuisance for some users. I rather not delete it (as I am the only user of my PC), but the deletion can come in handy in work environments, where you can be ridiculed by co-workers by typing "pink www.google.com" instead of ping.

First of all, be sure to be logged as the user, whose Terminal history you wish to clear/modify.

The most basic way is the complete wipe with this command:
history -c

You could also delete an individual notation in history by doing this:
history -d PIN

(eg. history -d 1300)

(*Note, that the PIN is shown when you run 'history' in the Terminal. It is the number noted infront of the commands you ran, check picture bellow)





This will however leave a track. It will be recorded in history :)

If you wish to avoid that open the .bash_history file with an text editor and manually find&delete that damn line:
sudo gedit ~/.bash_history

Enjoy!

10 comments: