Tuesday, November 24, 2009

Delete Bash History

History of bash sessions are stored in the RAM and written back to ~/.bash_history when the user logs out of the bash session.

To delete the bash history:

1. Delete the .bash_history file:
rm -rf ~/.bash_history
2. Clear the current history stored in RAM:
history -c
Stop logging the bash histories

● Turn off bash history for all users
Append “unset HISTFILE” to /etc/profile:
echo "unset HISTFILE" >> /etc/profile

● Turn off bash history for a specific user
Append “unset HISTFILE” to /home/USER/.bash_profile:
echo "unset HISTFILE" >> /home/USER/.bash_profile