Collecting & Displaying of Last User ID and Date of Last Login


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Collecting & Displaying of Last User ID and Date of Last Login
# 1  
Old 03-21-2007
Error Collecting & Displaying of Last User ID and Date of Last Login

Hi,

I needed to write a script to "Collect and Display the Last User ID and Date of Last Login".

The requirement is:
When a workstation stops reporting it could be for many reasons. If we know the last person who logged in before the workstation came down, then we can contact the last person to login to that specific machine and ask them if they know what has happened to the workstation.

Can someone provide a script to "Collecting & Displaying of Last User ID and Date of Last Login".

Thanks in advance,
amittal
# 2  
Old 03-21-2007
last - display login and logout information about users and terminals

The last command looks in the /var/adm/wtmpx file, which
records all logins and logouts, for information about a
user, a terminal, or any group of users and terminals. Argu-
ments specify names of users or terminals of interest. If
multiple arguments are given, the information applicable to
any of the arguments is printed. For example, last root con-
sole lists all of root's sessions, as well as all sessions
on the console terminal. last displays the sessions of the
specified users and terminals, most recent first, indicating
the times at which the session began, the duration of the
session, and the terminal on which the session took place.
last also indicates whether the session is continuing or was
cut short by a reboot.

example:

Code:
root@mp-wst01 # last -a | more
pressy    pts/3        Wed Mar 21 18:53   still logged in  pressynb.ips.local
pressy    sshd         Wed Mar 21 18:53   still logged in  pressynb.ips.local
root      pts/2        Wed Mar 21 18:50   still logged in  pressynb.ips.local
root      sshd         Wed Mar 21 18:50 - 18:53  (00:02)   pressynb.ips.local
root      pts/2        Wed Mar 21 17:51 - 17:52  (00:00)   pressynb.ips.local
root      sshd         Wed Mar 21 17:51 - 17:52  (00:00)   pressynb.ips.local
root      pts/2        Wed Mar 21 17:40 - 17:40  (00:00)   pressynb.ips.local
root      sshd         Wed Mar 21 17:40 - 17:40  (00:00)   pressynb.ips.local
root      pts/2        Wed Mar 21 16:36 - 17:07  (00:31)   pressynb.ips.local
root      sshd         Wed Mar 21 16:36 - 17:07  (00:31)   pressynb.ips.local



regards pressy
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

User Account Login Login on your AIX server

I want to learn AIX. I would like to find someone who would be willing to give me a login to their AIX home lab server. My intent is to poke around and discover the similarities and differences of AIX compared to other *NIXs. I am a UNIX admin so I can think of what some immediate concerns may... (1 Reply)
Discussion started by: perl_in_my_shel
1 Replies

2. Shell Programming and Scripting

Date not displaying correctly

Hi Experts, I tried to stay away from posting stuff here and asking for help. I want to print date valeu for a given variable and that is not working. #!/bin/bash START=`echo $1 | tr -d _`; FV=`echo $2` for (( c = 0 ; c < $FV ; c++ )) do # echo -n "`date --date="$START +$c day"... (12 Replies)
Discussion started by: PG3
12 Replies

3. Shell Programming and Scripting

Displaying every date since 2007

Hi, I need to write a script that displays every date from 01/01/2007 to 03/31/2010 in the format mm/dd/yyyy. There doesn't seem to be a "datecalc" command on my system. Any inputs? Thanks, (4 Replies)
Discussion started by: 17amrut29
4 Replies

4. Solaris

error message rmclomv ... SC Login Failure for user Please login:

Hello World ~ HW : SUN Fire V240 OS : Solaris 8 Error message prompts 'rmclomv ... SC login failure ...' on terminal. and Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S) The System is in normal operation, though In case of rain, Can... (1 Reply)
Discussion started by: lifegeek
1 Replies

5. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

6. Shell Programming and Scripting

Displaying Date

Hi, Am new to unix..i want some help.. when am using ls command like ls-ltr it displaying output like this: rw-r--r-- 1 infauser dba 36 Jun 16 12:36 s1_midify -rw-r--r-- 1 infauser dba 66 Jun 16 12:42 sample_one -rw-r--r-- 1 infauser dba 77 Jun 16 13:05... (3 Replies)
Discussion started by: sujana
3 Replies

7. UNIX for Dummies Questions & Answers

Last user login date

I have been asked to create a report of when users last logged into an AIX box. Upon login, this information appears to be available but I have not located it yet. Any help? Thanks! (2 Replies)
Discussion started by: JTeter
2 Replies

8. Shell Programming and Scripting

Collecting & Displaying of Last User ID and Date of Last Login

Hi, I needed to write a script to "Collect and Display the Last User ID and Date of Last Login". The requirement is: When a workstation stops reporting it could be for many reasons. If we know the last person who logged in before the workstation came down, then we can contact the last... (1 Reply)
Discussion started by: amittal
1 Replies

9. UNIX for Dummies Questions & Answers

Displaying file names before a particular creation date

Hi!! I wanna display file names which are created before/after a particular date. I wud be glad if anybody can help me out in that. Thanx Dhruv (1 Reply)
Discussion started by: dhruv_saksena
1 Replies

10. Shell Programming and Scripting

displaying date

Hi All, When I type date..I get the date, time ..etc displayed ...but can someone help me to display yesterdays date... some script to display back dates. Thanks in advance Minaz (7 Replies)
Discussion started by: minazk
7 Replies
Login or Register to Ask a Question