Subversion Repositories sysadmin_scripts

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/perl -w

# http://www.cyberciti.biz/tips/linux-display-open-ports-owner.html

@list = `lsof -i | grep xfce4-ses`;
print "Users Logged in\n";
for ( $i = 0;$i < @list; $i++ ) {
   my ( $COMMAND,$PID,$USER,$FD,$TYPE,$DEVICE,$SIZE,$NODE,$NAME ) = split ( " +", $list[$i] );
   print "$USER\t$PID\txfce4\n";
}

@list = `w`;
for ( $i=2; $i < @list; $i++ ) {
   my ( $USER,$TTY,$FROM,$LOGIN,$IDLE,$JCPU,$PCPU,$WHAT ) = split( " +", $list[$i] );
   print "$USER\t$TTY\tconsole\n";
}