nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Quit Bash Without Saving History

This is a discussion on Quit Bash Without Saving History within the Getting started tutorials forums, part of the Linux Getting Started category; Hello Nixcraft, I came across this command on the web and I thought I would share it with you all. ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Linux answers from nixCraft.


Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2009, 11:16 PM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 604
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default Quit Bash Without Saving History

Hello Nixcraft,

I came across this command on the web and I thought I would share it with you all.

There has been times where I have accidentally copied a full page of text and pasted it into a bash terminal only to have a 100 command not founds.

Well were I work there are multiple admins that check the root bash history. I would not want them to see my rookie mistake. The resolution is to run this to exit bash without creating a command history.

Code:
Prompt>kill -9 $$
$$ gives the pid of the current bash instance, and the kill ends the process. There are ways to disable the history in BASH, but at my office we use the history to our advantage. So this can get you out of a jam.

Have fun.

HTH

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com
Reply With Quote
  #2 (permalink)  
Old 02-09-2009, 02:13 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Also you can nuke history when you logout by adding the following to your ~/.bash_logout file:
Code:
# clear bash history
/bin/rm -f $HOME/.bash_history

# clear mysql history
/bin/rm -f $HOME/.mysql_history
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
The Following 2 Users Say Thank You to nixcraft For This Useful Post:
chimu (02-09-2009), jerry (04-09-2009)
  #3 (permalink)  
Old 02-09-2009, 02:20 AM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 604
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default

SOOO Sweet,

However if everyone uses root, this will nuke all history? In my situation we are currently all using root as our login. And I am sure our company is not alone with this setup

In fact I am learning LDAP so we can all have individual logins for the root account.

My senior admin and I are testing this now.


Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com
Reply With Quote
  #4 (permalink)  
Old 02-09-2009, 02:24 AM
chimu's Avatar
Contributors
User
 
Join Date: Mar 2005
OS: Ubuntu
Posts: 79
Thanks: 23
Thanked 4 Times in 3 Posts
Rep Power: 6
chimu is on a distinguished road
Default

Share root account without a root password. sudo - Wikipedia, the free encyclopedia
Reply With Quote
  #5 (permalink)  
Old 02-09-2009, 02:54 PM
kumarat9pm's Avatar
Senior Member
User
 
Join Date: Jun 2007
Location: Pune,MH,India
OS: RHEL,UBUNTU..
Posts: 450
Thanks: 20
Thanked 20 Times in 18 Posts
Rep Power: 5
kumarat9pm has a spectacular aura about kumarat9pm has a spectacular aura about kumarat9pm has a spectacular aura about
Send a message via Yahoo to kumarat9pm Send a message via Skype™ to kumarat9pm
Default mine is not up to the point but want to share mine

we can set the HISTSIZE=0 which will clear all your history(only tat terminial)not for other terminials..
and then revert back the Value to some 100 or what ever you want
#HISTSIZE=100

Note for new babys:HISTSIZE is the variable where we can mention how many commands the history command should store.
if HISTSIZE=10, your history command will just show last 10 executed commands..
Reply With Quote
The Following User Says Thank You to kumarat9pm For This Useful Post:
jerry (04-09-2009)
Reply

Tags
.bash_logout , .mysql_history , kill -9 $$ , kill command , rm command


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Linux kernel Do you have a strange power saving mode enabled? Rahul.Kolan Linux hardware 3 08-09-2009 11:45 AM
bash history...suse 10.1 grogf Linux software 4 30-10-2007 04:42 PM
How to save history of a hung terminal ricc Linux software 2 20-06-2006 12:21 AM
Command history ricc Linux software 1 26-04-2006 04:57 PM
want a script keep backup of all users history. ricc Shell scripting 3 26-08-2005 12:30 AM


All times are GMT +5.5. The time now is 08:06 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38