Difference between revisions of "Quit Bash Shell without Saving Bash History"
From Brian Nelson Ramblings
(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...") |
|||
Line 23: | Line 23: | ||
echo "alias nohistory='history -c && exit'" >> ~/.bashrc | echo "alias nohistory='history -c && exit'" >> ~/.bashrc | ||
+ | |||
+ | [[Category:Centos]][[Category:Bash]] |
Latest revision as of 14:45, 14 March 2014
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