HostOnNet Blog

How to Clear current session history (bash)

Looking for Linux Server Admin or WordPress Expert? We can help.

history_ssh

To clear the history, type the following command:


history -c

Type the following command to remove a certain line (e.g. 890) from the Bash history file :


history -dw 890

-c Clear the history list 
-d Delete specified line from the history

Don’t save commands in bash history

Unsetting HISTFILE will cause any commands that you have executed in the current shell session not to be written in your bash_history file upon logout :


unset HISTFILE

About Annie

I've been working in Technical Section for over 10 years in a wide range of tech jobs from Tech Support to Software Testing. I started writing blog for my future reference and useful for all.

3 Responses to How to Clear current session history (bash)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.