Highlighted
Hot Shot
Hot Shot

Clear last used commands on console?

Jump to solution

I am using the command line on the ESX console. I have a certain command I use that needs a password passed with the command. I want to make sure this is gone when I am done with it. If I push the up arrow I can cycle through the commands and find the previously entered command with the password in it. how can I clear this command without logging out?

I guess this is more of a general unix question, but was hoping it was an easy one for the linux gurus on this site.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
Highlighted

history -c should do the job for you.

View solution in original post

0 Kudos
4 Replies
Highlighted
Immortal
Immortal

Is there a man page for history command?

Highlighted

history -c should do the job for you.

View solution in original post

0 Kudos
Highlighted
Hot Shot
Hot Shot

Thanks, that worked.

FYI, logging out doesn't seem to clear the previous commands, so the history -c command seems rather important. I logged out of a SSH session and when I logged back in, I could still cycle to my old commands. This included the command with my password! using the history -c command clears it permanently

0 Kudos
Highlighted

You can also try the following to disabled history completely. Edit /etc/profile

and change

HISTSIZE=1000 to HISTSIZE=0

and add

unset HISTFILE

The 2nd change will disable the history file (/root/.bash_history for the root user) and the 1st change will disable history within a session itself.