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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-04-2009, 02:36 PM
|
#1
|
|
LQ Newbie
Registered: Feb 2009
Posts: 2
Rep:
|
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.
|
|
|
|
02-04-2009, 03:05 PM
|
#2
|
|
Member
Registered: Dec 2005
Location: Oregon
Distribution: Debian Testing
Posts: 488
Rep:
|
Not sure, but auth.log should have the log-in and log-out times.
|
|
|
|
02-04-2009, 03:35 PM
|
#3
|
|
Member
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770
Rep:
|
you can do:
last | grep username
|
|
|
|
02-04-2009, 03:41 PM
|
#4
|
|
Member
Registered: Dec 2005
Distribution: Slackware -current, 14.0
Posts: 958
Rep: 
|
Quote:
Originally Posted by ncsuapex
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 03:43 PM.
|
|
|
|
02-05-2009, 02:01 AM
|
#5
|
|
LQ Newbie
Registered: Feb 2009
Posts: 2
Original Poster
Rep:
|
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?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:21 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|