last login date and time for all users


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers last login date and time for all users
# 1  
Old 11-08-2007
last login date and time for all users

I need a command [or script] that will list all the users and their last login date & time. I was trying the last command and the who command, but can't get exactly what I need.
I just need the output to be user name and last login date [and time if available].
Thanks for your help!
# 2  
Old 11-08-2007
Both "finger" and "who" will return this information.

"who" would be the simplest to parse.
# 3  
Old 11-08-2007
who or finger only give me the users that are currently on the system.
I need all users who are and aren't logged in at this time.
I need their last login date whether it is today or a year ago.
# 4  
Old 11-08-2007
This might be what you are looking for...

Code:
man last

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code: archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (0 Replies)
Discussion started by: rehantayyab82
0 Replies

2. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

3. Solaris

Passwordless Login between users

Hi Gurus, Wanted to know if there is a way to enable passwordless login between specific users in a Solaris (5.9)server. I copied the public key of first user into the $HOME/.ssh/authorized_keys file of the second user. But it didn't work out. Note - Am talking about users in the same... (9 Replies)
Discussion started by: Hari_Ganesh
9 Replies

4. UNIX for Dummies Questions & Answers

Date, time, users

i need to find out following ways to show out put in a shell script when the user selects that option in a case statement. I have the case statement already started just need to find out how to read the following: current date and time (should it be read date)? users logged in (should it be... (4 Replies)
Discussion started by: vthokiefan
4 Replies

5. HP-UX

No users can login

Dear Forum, I had this case before, all of sudden all users including root can't login. What done is by connecting to console port and resetting root password, "pwunconv" command, reboot server. My question is, how this can happen??? thanks :confused: (3 Replies)
Discussion started by: irda
3 Replies

6. UNIX for Dummies Questions & Answers

How to do a login time and date list of users never logged on?

Hello, I'm trying to do a list of user that never connected to a couple of servers. I want to do a diff between the servers lists, and print out only the users that never has logged on each server. Here my first step : SERVER01: # finger `egrep -v -e "^\s*#" /etc/passwd | awk '{ print $1 }' |... (4 Replies)
Discussion started by: gogol_bordello
4 Replies

7. UNIX for Dummies Questions & Answers

script to write the last login date and time

I want to make a script to write me in a file the date(format 16-12-2008) and hour(format 15:12:21) of the last login in the system; what can i add to the <last> command in order to be suitable? (4 Replies)
Discussion started by: kalimat
4 Replies

8. Programming

how can get users list and their login time?

i'm sorry if yesterday i posted this thread in unix for dummies forums, :D i am a newbie in C programming i want to get active users list and their login time... i have search and learn about passwd and utmp, but i only can get user list without their login time... do you have an idea... (2 Replies)
Discussion started by: alif
2 Replies

9. Shell Programming and Scripting

users login

Hello everyone I need to send to a file the last command from all users who log in and log out by week or month. My questions are I can do it with the command or I need to do a script ? If the answer is I need to do a script, someone can help me because Im complete new to make a... (3 Replies)
Discussion started by: lo-lp-kl
3 Replies

10. UNIX for Dummies Questions & Answers

Script to display last login date/time?

I was wondering if anyone had a script that would display the last time a user logged into a particular machine. I know about the "last" command, but it gives too much info.... I just wanted to know the last time a user used his/her id. ANy help would be greatly appreciated. Ryan (3 Replies)
Discussion started by: ryaneverett5
3 Replies
Login or Register to Ask a Question