The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
URGENT,URGENT- Need help tape drive installation sriny UNIX for Advanced & Expert Users 3 11-16-2006 11:43 AM
URGENT---URGENT--No OK PROMPt after RSC CONFIG sriny SUN Solaris 7 10-29-2006 07:06 AM
cannot login after changing login shell hardesh HP-UX 4 09-13-2005 09:21 PM
please help urgent mkan UNIX for Dummies Questions & Answers 5 09-08-2005 12:15 PM
urgent xinubhaskar UNIX for Advanced & Expert Users 1 02-08-2003 06:37 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Jan 2008
Posts: 8
Last login<urgent>

how to find last login time of a user in faster way if wtmps size is too large??
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Jan 2008
Posts: 8
Last login<urgent>

Last login<urgent>
how to find last login time of a user in faster way if wtmps size is too large??
Reply With Quote
  #3 (permalink)  
Old 02-05-2008
vbe vbe is offline
Registered User
 

Join Date: Sep 2005
Location: Switzerland
Posts: 427
What wrong with last?

last <user> |head -1
Reply With Quote
  #4 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Jan 2008
Posts: 8
last login

thanks vbe...
but this command takes long time to give the output if we display a list of users with last login value when wtmp is huge..
any other solution???

thanks,
Vishwaraj
Reply With Quote
  #5 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Mar 2006
Location: Ahmedabad
Posts: 113
Try with -n option it will be probably faster then getting all records
Reply With Quote
  #6 (permalink)  
Old 02-06-2008
vbe vbe is offline
Registered User
 

Join Date: Sep 2005
Location: Switzerland
Posts: 427
>how to find last login time of a user in faster way if wtmps size is too large??
I though your question was the last login of A user, in such case my command to type should not take more than 4 seconds at the most or you have some trouble (the longest delay I got so far was 1.5!)
I did not say to type last, as this will display all the successfull attempt of all the users since the origin of wtmp, but last <your user name>| head -1 (the first line: the last login) or whatever lines you need or as suggested: last -1 <username> which would be faster still...

Here are some records:

ant:/var/spool/cron/crontabs $ timex last|wc -l

real 16.32
user 9.40
sys 1.55

182882
ant:/var/spool/cron/crontabs $ timex last vbe|head -1
vbe pts/1 Thu Jan 31 16:26 - 16:33 (00:06)


real 0.42
user 0.19
sys 0.08

ant:/var/spool/cron/crontabs $ timex last -1 vbe
vbe pts/1 Thu Jan 31 16:26 - 16:33 (00:06)

real 0.03
user 0.01
sys 0.01

With 182882 records it replies (almost) instantly...

No doubt last -1 name is the fatest...

I suggest that you resize wtmp at something reasonable if it is giving you trouble... ( save a copy before for archive history... since you can use last specifying a filename also! great no?)

If you have may users you want the information write a script that read the list of names

All the best
Reply With Quote
  #7 (permalink)  
Old 02-06-2008
Registered User
 

Join Date: Jan 2008
Posts: 8
thanks a lot vbe

got an idea...
i'l try it by writing a script for the names of all users...


thanks,
vishwaraj
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:04 PM.


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

Content Relevant URLs by vBSEO 3.2.0