Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to list a user's last login time/date?

1,383 views
Skip to first unread message

Dennis Ashworth

unread,
Sep 4, 1995, 3:00:00 AM9/4/95
to
How can I get a list of users and the last time/date they logged into the
system? I don't use accounting. I know it is stored in the lastlog
file and the lsuser command will list it out, but what format
is the time_last_login in? BTW, I'm using AIX 3.2.5.

Thanks in advance!


dash...@uga.cc.uga.edu

Rogan Dawes

unread,
Sep 4, 1995, 3:00:00 AM9/4/95
to

I would suggest using the "last" command . . .

e.g. last login USERNAME

Rogan
--
Rogan Dawes rda...@jhbelec.co.za Tel: (011) 490-7379 Fax: (011) 490-7327
"All power corrupts, but we need electricity." - fortune


Jim Sherwood

unread,
Sep 5, 1995, 3:00:00 AM9/5/95
to
DASH...@UGA.CC.UGA.EDU (Dennis Ashworth) wrote:

>How can I get a list of users and the last time/date they logged into the
>system? I don't use accounting. I know it is stored in the lastlog
>file and the lsuser command will list it out, but what format
>is the time_last_login in? BTW, I'm using AIX 3.2.5.
>
>Thanks in advance!
>
>
>dash...@uga.cc.uga.edu

I use "last username | more"

j...@sherwood.mv.com
j...@enterprise.uml.edu

John Andrea

unread,
Sep 5, 1995, 3:00:00 AM9/5/95
to
DASH...@UGA.CC.UGA.EDU (Dennis Ashworth) writes:
>How can I get a list of users and the last time/date they logged into the
>system? I don't use accounting. I know it is stored in the lastlog
>file and the lsuser command will list it out, but what format
>is the time_last_login in? BTW, I'm using AIX 3.2.5.

Get a program called date-math
then do this date-math -u <date from time_last_login>

i do it in a user tool script like this
if info=$(lsuser -c -a time_last_login $1) ; then
#checking this one now is useful in case its null (i.e. never
logged i
n)
attributes=$( print $info | cut -d" " -f2- )
if [[ $attributes = $1 ]]; then
lastlogin=""
else
lastlogin=$( print $attributes | cut -d: -f2)
fi

#...print a line about the last login time
if [[ $lastlogin = "" ]]; then
print Never logged in.
else
print Last login was: \
$(/usr/local/bin/date-math -u $lastlogin )
fi


--
__________________________________________________________________
John Andrea St. Francis Xavier Univ.
University Computer Services Antigonish, NS, CANADA B2G 2W5
http://www.stfx.ca/people/jandrea/

0 new messages