Logout from shell without saving bash history
Here I am explaining different methods to logout from shell without saving bash history.
Run the above command before loging out from the server to exit from terminal without saving bash history.
kill -9 $$
The above command will kill the current terminal without saving the history.
The above command will change the HISTSIZE to zero. Hence it can’t store the current history.
This command also clears the current session history.
It will delete the all bash history. i.e., the earlier history will be removed.
If you would like to avoid only some commands in the history file, you can set the HISTIGNORE variable.
Any instance of cat and cd will not be recorded on your bash history if you use the above command.
Also, if you would like to avoid some particular commands, you can set HISTCONTROL variable.
By setting the above command will help to omit any command lines starting with space.
It will skip repeated lines.
If you like this post and wish to receive more articles from us, please like our FB page: Grepitout
Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.
For more details on our services, please drop us an E-mail at firstname.lastname@example.org
[…] Also Read: How to logout from shell without saving bash history […]