how to clear history | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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 !!

how to clear history

UNIX for Dummies Questions & Answers


Tags
clear history

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-15-2006
gincemathew gincemathew is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 17 July 2006, 5:41 AM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Error 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 01:54 PM..
Sponsored Links
    #2  
Old 07-15-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
kharkovpromenade.com.ua
 
Join Date: Jun 2006
Last Activity: 10 December 2011, 9:33 AM EST
Posts: 360
Thanks: 0
Thanked 9 Times in 8 Posts
I think it depends on your shell
e.g. for bash you can clear history by truncating ~/.bash_history file
Sponsored Links
    #3  
Old 07-15-2006
gincemathew gincemathew is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 17 July 2006, 5:41 AM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
how in ksh
    #4  
Old 07-17-2006
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
 
Join Date: Jun 2006
Last Activity: 1 December 2008, 8:39 AM EST
Location: Madrid (Spain)
Posts: 531
Thanks: 0
Thanked 1 Time in 1 Post
In ksh:

Code:
> $HOME/.sh_history

will empty the command history.
Sponsored Links
    #5  
Old 01-08-2008
chandrum chandrum is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 8 January 2008, 6:17 AM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Tools

if u use bash then

use the following command

$ history -c
Sponsored Links
    #6  
Old 01-08-2008
frank_rizzo frank_rizzo is offline Forum Advisor  
Resident BOFH
 
Join Date: Dec 2007
Last Activity: 21 August 2014, 4:30 PM EDT
Posts: 1,136
Thanks: 2
Thanked 88 Times in 85 Posts
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.
Sponsored Links
    #7  
Old 08-31-2008
rdkumarj rdkumarj is offline
Registered User
 
Join Date: Jul 2007
Last Activity: 30 September 2013, 1:11 PM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to clear history in ksh? lg123 Shell Programming and Scripting 4 01-01-2012 06:46 AM
How to clear history in Linux NARESH1302 UNIX for Dummies Questions & Answers 7 12-15-2010 07:01 AM
How to clear history logs of all terminal sessions royalibrahim Shell Programming and Scripting 3 09-06-2010 08:51 AM
how to clear command history prabir Solaris 3 12-20-2008 11:14 AM
clear passwd history without ... A Stewart UNIX for Advanced & Expert Users 4 05-27-2005 10:56 AM



All times are GMT -4. The time now is 06:07 AM.