Subversion Repositories sysadmin_scripts

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
24 rodolico 1
#! /usr/bin/perl -w
2
 
3
# http://www.cyberciti.biz/tips/linux-display-open-ports-owner.html
4
 
5
@list = `lsof -i | grep xfce4-ses`;
6
print "Users Logged in\n";
7
for ( $i = 0;$i < @list; $i++ ) {
8
   my ( $COMMAND,$PID,$USER,$FD,$TYPE,$DEVICE,$SIZE,$NODE,$NAME ) = split ( " +", $list[$i] );
9
   print "$USER\t$PID\txfce4\n";
10
}
11
 
12
@list = `w`;
13
for ( $i=2; $i < @list; $i++ ) {
14
   my ( $USER,$TTY,$FROM,$LOGIN,$IDLE,$JCPU,$PCPU,$WHAT ) = split( " +", $list[$i] );
15
   print "$USER\t$TTY\tconsole\n";
16
}
17