Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lastlog(8) [linux man page]

LASTLOG(8)						    System Management Commands							LASTLOG(8)

NAME
lastlog - reports the most recent login of all users or of a given user SYNOPSIS
lastlog [options] DESCRIPTION
lastlog formats and prints the contents of the last login log /var/log/lastlog file. The login-name, port, and last login time will be printed. The default (no flags) causes lastlog entries to be printed, sorted by their order in /etc/passwd. OPTIONS
The options which apply to the lastlog command are: -b, --before DAYS Print only lastlog records older than DAYS. -h, --help Display help message and exit. -t, --time DAYS Print the lastlog records more recent than DAYS. -u, --user LOGIN|RANGE Print the lastlog record of the specified user(s). The users can be specified by a login name, a numerical user ID, or a RANGE of users. This RANGE of users can be specified with a min and max values (UID_MIN-UID_MAX), a max value (-UID_MAX), or a min value (UID_MIN-). If the user has never logged in the message ** Never logged in** will be displayed instead of the port and time. Only the entries for the current users of the system will be displayed. Other entries may exist for users that were deleted previously. NOTE
The lastlog file is a database which contains info on the last login of each user. You should not rotate it. It is a sparse file, so its size on the disk is usually much smaller than the one shown by "ls -l" (which can indicate a really big file if you have in passwd users with a high UID). You can display its real size with "ls -s". FILES
/var/log/lastlog Database times of previous user logins. CAVEATS
Large gaps in UID numbers will cause the lastlog program to run longer with no output to the screen (i.e. if in lastlog database there is no entries for users with UID between 170 and 800 lastlog will appear to hang as it processes entries with UIDs 171-799). System Management Commands 06/24/2011 LASTLOG(8)

Check Out this Related Man Page

llconvert(8)						      System Manager's Manual						      llconvert(8)

NAME
llconvert - Modify lastlog records from DIGITAL UNIX releases 4.0x and prior to new format SYNOPSIS
/usr/lbin/llconvert [-vnrp?h] input_file [output_file] OPTIONS
Restore new format to old format. Verbose. Display lines while converting. Do not preserve contents of input file. Formatted print only. Do not convert. (May be used with the -r option). Display usage message. DESCRIPTION
The llconvert command reads records from the lastlog file, such as /var/adm/lastlog, and converts the record format to the updated struct lastlog format. If no output file is specified or if the output file path is identical to the input file path, llconvert makes a backup copy of the original input file using the following algorithm: If filename.orig exists. Where n is a unique number. The llconvert command attempts to detect an input file that is in the wrong format (for example, input file is already a new format file). A warning message is issued in this case, but conversion continues. RETURN VALUES
Success. An error occurred. EXAMPLES
To convert an old format accounting file to the new format: llconvert /var/adm/lastlog.prev Upon completion of this command, /var/adm/lastlog.prev will have been converted to the new format. The original /var/adm/last- log.prev is renamed to: /var/adm/lastlog.prev.orig To convert a lastlog file in new format to the old format: llconvert -r /var/adm/lastlog /var/adm/last- log.old FILES
Lastlog header file that defines the format for the lastlog file. The active lastlog file. SEE ALSO
Commands: finger(1) llconvert(8)
Man Page

13 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sysadmin LOGIN msgs for all users

Is there a way, as sysadmin, to put out system msgs, ie scheduled downtime, backup info, etc, whenever users log in? (5 Replies)
Discussion started by: kymberm
5 Replies

2. UNIX for Dummies Questions & Answers

OVER RANGE signal on console

Hi, I did a hard disk recovery for one of my machines from another machine. I can ftp or remote log in to it, but at the console, the monitor gives me : " OVER RANGE" signal, i know it is a video card issue, but if i did a recovery from an identical machine which can be accesed from console, why... (3 Replies)
Discussion started by: BAM
3 Replies

3. UNIX for Dummies Questions & Answers

grep problem

just a file with thousands of filenames and I wanna get all files with the same extension, like .Z for example.... users/123/a.Z users/424234/fafa.Z users/424234/asda.log daa/dsss/222/efesa-01002-01:00-A.Z how to solve this issue? when you make.. grep .Z file >newfile grep ".Z"... (5 Replies)
Discussion started by: svennie
5 Replies

4. HP-UX

Is there a script available to kill Idle users

My max user parm is set to 1050. I'm currently at 1038 this is causing major slow downs on the server. I looking for a way log off "idle" user logins with out having to do it individually. :confused: (5 Replies)
Discussion started by: rfmurphy_6
5 Replies

5. Shell Programming and Scripting

Trying to get list of logged on users sorted

I'm trying to execute a single shell command that will give me a sorted list of all the users currently logged into the system, displaying the users name as it appears in /etc/passwd. I've tried awk -F: '{print $1}' /etc/passwd | xargs finger -s | cut -c11-28 | uniq This list whoever does... (7 Replies)
Discussion started by: kungfuice
7 Replies

6. Shell Programming and Scripting

detecting login or logout

what function would tell me that a user has logged in or out? i already know from my script the users name i already know in real time there was an event how an I tell if that event was a login or logout? Any ideas? # i did try comparing the file sizes for change but various users may... (8 Replies)
Discussion started by: nortypig
8 Replies

7. UNIX for Dummies Questions & Answers

How to log what users are doing??

Guys i am new in forum and come to ask some help in this. What i want is to log what users are doing. Someone told me to make a script and get the history commands of all users and storage this in a DB. but the problem in this is, i want to log all things. Why this? why my 2 machines is only a... (4 Replies)
Discussion started by: Amgrim
4 Replies

8. AIX

System Logs

Dear Gurus I am running AIX with several users that are using the system, i would like to monitor the commands that are run by these users. Is there a log system that records the commands that are executed by the users??? Any kind of help will be appreciated. Regards Masquerder (6 Replies)
Discussion started by: masquerer
6 Replies

9. AIX

Track user logoff in AIX 5.3

Hi Does anybody know if there is a way in AIX 5.3 to track how a user was logged off? For instance where the user typed exit, hit crtl D, shell process was killed, etc. I know of the last log entries but this just shows a users login time and duration. I also tried syslog but I only get login... (5 Replies)
Discussion started by: kimyo
5 Replies

10. Shell Programming and Scripting

How to display what processes, users have opened at a given time

Hello, What i have to do is make a top 10 list of users sorted by the number of processes opened at a given time. Can anyone help me with finding out for a given moment, for all users how many processes each had opened? (5 Replies)
Discussion started by: gabibyte
5 Replies

11. AIX

User creation

hi seniors i want to create the users like when the user try to login it should not should not promt for passwd is it possible to create users like this please help me (6 Replies)
Discussion started by: senmak
6 Replies

12. UNIX for Advanced & Expert Users

Not getting full name of last logged-in user in linux

last unix command shows the list of last logged-in users. But the usernames are trimmed to eight characters. Is there any other way to get the full login name of last loggedin user ? I tried lastlog command, but this command not listing user info in some machines. (7 Replies)
Discussion started by: prasankn
7 Replies

13. Homework & Coursework Questions

Sort current logged in users by log in time (supposedly to be very easy but I'm missing something)

1. The problem statement, all variables and given/known data: Show all users who are currently logged in, sorted from earliest to latest log in time. The log in time includes the month, day, and time. 2. Relevant commands, code, scripts, algorithms: finger, who, sort, pipe, head, tail, ... (8 Replies)
Discussion started by: vtmd
8 Replies