How to delete last command on linux command line interface

For example you have just execute a command on Linux’s CLI. And since the command contains sensitive information, you have to delete it from the commands’ history.

You can use the command:

history -d number_of_the_comment

For example you access a command #history to display the commands’ history on your Linux engine.

# history
1 rpm -ivh bla..bla..bla..
2 mpg123 file1.mp3
3 mail people@secret_website.com
4 history

To delete the mail command, you can use

history -d 3 [click enter]

Tags: ,

Google
 

Leave a Reply

117 views