natjohan's blog

Posted mer. 23 octobre 2013

Tip of the week 26

Erase your command line history

Here is a little tip to erase your command line history on a linux machine, simply use the history command, that's a built'in shell command which allows you to show your command history in your terminal. Having an history of your command is quite useful in many situations, but sometimes, when you use some confidential data (eg. passwords) in your command, you should delete the whole or a particular entry of this history

    natjohan# history
4  ping 8.8.8.8
5  openssl passwd -1 mypassword
6  echo ioldelaiiiou
7  history
    natjohan# history -d 5
    natjohan# history
    4  ping 8.8.8.8
5  echo ioldelaiiiou
6  history
7  history -d 5
8  history
natjohan# history -c
natjohan# history
4  history

So history shows you your history, history -d line_number delete a particular entry and history -c delete the whole list

Go further

RTFM : man history

Category: ToTW
Tags: linux command line history terminal

Comments