If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Clear history on z-Linux and AIX servers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-07-10, 12:17
pinecone pinecone is offline
Registered User
 
Join Date: Apr 2004
Posts: 58
Lightbulb Clear history on z-Linux and AIX servers

Does anyone know the command on how to clear previous commands issued on AIX and Linux operating systems?

I tried "history -c" and "history clear" but did not work.

I did "history -100" and saw all the previous commands I executed, even after I logged off from the session. For security concerns, I would like to clear all the command history.

Any inputs would be greatly appreciated.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 06-07-10, 14:15
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
rm ~/.bash_history

Or vi ~/.bash_history and remove the incriminating lines.
Reply With Quote
  #3 (permalink)  
Old 06-07-10, 15:47
pinecone pinecone is offline
Registered User
 
Join Date: Apr 2004
Posts: 58
I tried both. They cleared up most of the history. Now see the last 15 or so commands I typed when issued "history".

How can I clear all previous commands?

Thanks for your help.
Reply With Quote
  #4 (permalink)  
Old 06-07-10, 15:57
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
I don't think that you can. There seems to be a buffer of a hundred characters or so that gets written to the file when you log off. The best might be to fill the buffer with commands like "date" or "ls -l" etc.
Reply With Quote
  #5 (permalink)  
Old 06-08-10, 09:47
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
Was reading the manual page for something else this morning, and I see that ksh-93, includes a "hist" command that "Using the hist built-in command within a compound command will cause the whole command to disappear from the history file"
Reply With Quote
  #6 (permalink)  
Old 06-08-10, 16:57
pinecone pinecone is offline
Registered User
 
Join Date: Apr 2004
Posts: 58
"using hist built-in command within a compound command will cause the whole command to disappear from the history file"

I wonder what the command is.... please let me know if you find out.

Really appreciate you looking into this.

Thanks again!
Reply With Quote
  #7 (permalink)  
Old 06-14-10, 07:30
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
rm ~/.bash_history # clear hist file
kill -9 $$ # kill your process to kill cash
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On