Quit Bash Shell without Saving Bash History
From Brian Nelson Ramblings
Revision as of 07:05, 12 October 2013 by Brian (Talk | contribs) (Created page with "==Remove Only Current Session Bash History== You will sometimes come across instances where you do not want to leave a bash history of your current session. Example reason...")
Contents
- 1 Remove Only Current Session Bash History
- 1.1 1) Quit Bash Shell without Saving your History: Unset HISTFILE
- 1.2 2) Quit Bash by Killing your Current Console: Kill Console
- 1.3 3) Set your Bash Shell history to Zero(0): Set HISTSIZE 0
- 1.4 4) Clear History Option: Clear History(my fav)
- 1.5 5) Delete your HISTFILE and unset HISTFILE : Quit Bash
- 2 Creat an alias to Accomplish this task
Remove Only Current Session Bash History
You will sometimes come across instances where you do not want to leave a bash history of your current session.
Example reason, you are on a clients account and you do NOT want them to see what commands you ran on their account.
1) Quit Bash Shell without Saving your History: Unset HISTFILE
unset HISTFILE && exit
2) Quit Bash by Killing your Current Console: Kill Console
kill -9 $$
3) Set your Bash Shell history to Zero(0): Set HISTSIZE 0
HISTSIZE=0 && exit
4) Clear History Option: Clear History(my fav)
history -c && exit
5) Delete your HISTFILE and unset HISTFILE : Quit Bash
rm -f $HISTFILE && unset HISTFILE && exit
Creat an alias to Accomplish this task
echo "alias nohistory='history -c && exit'" >> ~/.bashrc