The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
clear passwd history without ... A Stewart UNIX for Advanced & Expert Users 4 05-27-2005 07:56 AM
Please help me clear up some confusion RoY_mUnSoN UNIX for Dummies Questions & Answers 2 02-25-2004 02:39 PM
clear memory fenomen UNIX for Dummies Questions & Answers 2 06-24-2003 06:33 AM
clear screen immanuelgangte High Level Programming 6 08-02-2002 09:09 AM
How to clear screen giannicello High Level Programming 2 05-14-2002 01:32 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-14-2006
Registered User
 

Join Date: Jul 2006
Posts: 4
Exclamation how to clear history

Hi...

i have one doubt pls...

1)can we clear the command line history in UNIX for a paricular login(scadm/root)if so how?.
2) can we see the time at which command executed.

history is showing like :

100 display
101 lock
102 exit

Last edited by gincemathew; 07-16-2006 at 10:54 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 07-15-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 360
I think it depends on your shell
e.g. for bash you can clear history by truncating ~/.bash_history file
Reply With Quote
  #3  
Old 07-15-2006
Registered User
 

Join Date: Jul 2006
Posts: 4
how in ksh
Reply With Quote
  #4  
Old 07-17-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
In ksh:
Code:
> $HOME/.sh_history
will empty the command history.
Reply With Quote
  #5  
Old 01-08-2008
Registered User
 

Join Date: Jan 2008
Posts: 1
Cool

if u use bash then

use the following command

$ history -c
Reply With Quote
  #6  
Old 01-08-2008
Registered User
 

Join Date: Dec 2007
Posts: 256
Quote:
Originally Posted by gincemathew View Post
2) can we see the time at which command executed.
tcsh supports this. ksh on most systems does not. ksh on AIX does support the timestamp. There maybe others though. This is really only there for convenience and should not be used as an absolute audit trail.
Reply With Quote
  #7  
Old 08-31-2008
Registered User
 

Join Date: Jul 2007
Posts: 4
How to remove " Previously executed command reference or line number"

Hi

Thanks for all your replies , Even you can edit ( vi ) the ".sh_history" file and remove the lines which you don't want to be shown when the $history command is issued , But if you Observe when using history command it shows something like this.

213 df -g /
214 ls
215 lscfg

if you edit the ".sh_history" file and delete few lines of commands which are executed previously, when you issue the history command those commands issued are not shown because we edited the file and deleted them. But that command reference line number ( like 213 and whatever ) are shown, How to remove these line numbers also " instead of truncating " the whole file...?

Thanks & Regards
Rajesh.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0