November 2019

Logout in Linux shell command prompt without leaving your commands history

When we logout in Linux shell command prompt, we leave all the commands we have executed in Bash history file. For some reason you don't want your activity to be traced, the following is a command that will prevent your history of commands to be saved:

  
kill -9 $$
  

Just in case this command is hard to remember, it is useful to make this command available for easy access by using up/down arrow keys . Edit your Bash history file:

  
vi ~/.bash_history
  

… and enter:

Tags