File: pwho

package info (click to toggle)
libsys-utmp-perl 1.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 226; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 341 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl -w

use Sys::Utmp ;
use POSIX qw(strftime);
use strict;

my $utmp = Sys::Utmp->new();


while (my $utent = $utmp->getutent()) 
{ 

    if ( $utent->user_process() )
    {
       print $utent->ut_user(),"\t",
             $utent->ut_line(),"\t",
             strftime("%b %d %I:%M",localtime($utent->ut_time())),"\n";
    }
}