Saturday, May 3, 2014

Execute linux command without leaving any trace to history


If you want to execute some Linux command without leaving any trace to history file. You can execute the command as below:

Method 1:

syntax:

alok@alok:~$ history -d $((HISTCMD-1) && linux_command










Method 2:

By keeping some space at the beginning of the command we can avoid logging commands in history.


















Note: This method is only applicable for Ubuntu OS.


Delete a particular command from history:

Now if you want to delete a particular entry from history then we can use the below command:

syantax:

alok@alok:~$ history -d $((HISTCMD-1)) && history -d line_number_of_command_in_history

Example:





5 comments:

  1. This post is quite tricky one....its really nice one

    ReplyDelete
  2. Great information..:) thanx alot for sharing.. :)

    ReplyDelete
  3. Thanks guys for your comments.

    Keep visiting...

    ReplyDelete