HostOnNet Blog

How to Clear current session history (bash)

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.