LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2009, 03:36 PM   #1
haplo
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Rep: Reputation: 0
how to get user login time


Hello, could someone tell me how to get each a user's login time on a linux system(meaning the time between his last login and the present or between his last login and the time when he left, if he's not logged currently). I've already tried finger and last but they only give me the date of the login or the interval.
 
Old 02-04-2009, 04:05 PM   #2
pentode
Member
 
Registered: Dec 2005
Location: Oregon
Distribution: Debian Testing
Posts: 488

Rep: Reputation: 38
Not sure, but auth.log should have the log-in and log-out times.
 
Old 02-04-2009, 04:35 PM   #3
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 43
you can do:

last | grep username
 
Old 02-04-2009, 04:41 PM   #4
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,076

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by ncsuapex View Post
you can do:

last | grep username
Exactly, but the OP claims that the last command doesn't give him this info. It certainly works for me, tho'
Code:
*****    pts/5        :pts/3:S.0       Wed Feb  4 06:09 - 06:30  (00:20)    
*****    pts/5        :pts/3:S.0       Tue Feb  3 05:02 - 06:02  (01:00)    
*****    pts/5        spare_room       Mon Feb  2 20:49 - 21:06  (00:17)    
*****    pts/5        :0.0             Mon Feb  2 16:52 - 16:52  (00:00)    
*****    pts/3        :0.0             Mon Feb  2 11:03   still logged in   
*****    pts/3        :0.0             Mon Feb  2 10:57 - 11:03  (00:05)    
*****    pts/3        :0.0             Mon Feb  2 10:55 - 10:57  (00:02)    
*****    pts/2        :0.0             Mon Feb  2 10:05   still logged in   
*****    pts/0        :0.0             Mon Feb  2 08:15   still logged in   
*****    pts/3        :pts/1:S.0       Mon Feb  2 06:33 - 06:50  (00:16)    
*****    pts/5        :0.0             Sun Feb  1 10:16 - 05:39  (19:22)    
*****    pts/4        :0.0             Sun Feb  1 10:15 - 10:16  (00:01)    
*****    pts/3        :pts/2:S.0       Sun Feb  1 10:09 - 10:46  (00:37)    
*****    pts/3        :pts/2:S.0       Sun Feb  1 08:04 - 08:29  (00:24)

cheers,

Last edited by mrclisdue; 02-04-2009 at 04:43 PM.
 
Old 02-05-2009, 03:01 AM   #5
haplo
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Oh, I see, I thought the info in round brackets after the login interval were minutes and seconds so i ignored it. Pretty stupid thing to do ,really. Thank you for the quick replies, that solves half of the problem. I stil notice that the users that are still logged on don't have the login duration up to the current time calculated. Isn't there a way to get that too?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
finding login time and idle time,..etc from a list of users knavramesh Linux - Newbie 2 10-02-2008 11:55 PM
Hello all 2nd time linux user ...first time wasn't so successful kennypoopoo Linux - Newbie 3 09-11-2008 02:14 PM
Long time user, first time poster to LinuxQuestions.org nevek LinuxQuestions.org Member Intro 1 07-21-2008 11:18 AM
Long time Windows users, first time Linux user Towjam LinuxQuestions.org Member Intro 1 06-21-2008 01:08 PM
Gnome: Cannot login as default user, sends back to login, works as root Danny-T Linux - Newbie 2 05-27-2006 04:44 AM


All times are GMT -5. The time now is 10:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration