in reply to View last login times of everyone on your system

Which systems is this for? On my Solaris (5.8) machine, there's no lastlog in the man pages or in /var/log/. But we do have a handy utility called "last", which makes this fairly easy:
open(LASTLOG, 'last|') or die "Try Randal's script instead: $!\n"; my %logins; while (<LASTLOG>) { my ($name, $from) = split ' ', $_, 3; print unless $from eq 'ftp' or $logins{$name}++; }
Or go with the command-line one-liner: last | perl -lane 'print unless $F[1] eq "ftp" or $logins{$F[0]}++' Caveat: there may be other connections you want to exclude besides ftp. Season to taste.

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
•Re: &cow;Re: View last login times of everyone on your system
by merlyn (Sage) on Jan 15, 2004 at 19:57 UTC
    BSD-derived systems generally have both last and lastlog, and they do different things. Generally the log used by last is truncated routinely, so you won't get history back to day one, whereas the /var/log/lastlog file is also the file used by login to tell you when you last logged in, so it never gets truncated.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      Thanks. For others who don't have helpful man pages: on Solaris, at least, it's in /var/adm, and the structure of the file can be deciphered from /usr/include/lastlog.h: my $struct_lastlog = "L a8 a16";

      The PerlMonk tr/// Advocate