For security reason you may want to clear the history file and the screen when you hit CTRL+D or type logout command as you donâ€™t want to left content on screen (i..e avoid an information leak). Some Linux distro may clear the screen but others do not clear the screen when you logout.
When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists. Basically you can use this file as the individual login shell cleanup file, executed when a login shell exits.
There is a simple solution to this problem, open your ~/.bash_logout file:
$ vi ~/.bash_logout
Append any one of the following command:
You can also reset your history by appending following commands:
First one will clear bash history and 2nd command will clear mysql command history using shell REDIRECTION operator >.Share this on: