Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

port number -> PID

Status
Not open for further replies.

bandez

IS-IT--Management
Jul 8, 2002
42
GB
Hello,

How can I know to which port belongs to which process?
E.g :
netstat -a said:
udp4 0 0 *.54263 *.*
Which process listen on 54263?

Thanks !!
 

lsof -i 54263

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Hi bandez

Here is a small script to find any port(listening) versus process

#!/bin/ksh
#script title=/tmp/port-process.ksh
netstat -a|grep LISTEN|awk {print $4}>/tmp/port.list
for PORT in `cat /tmp/port.list`
do
/usr/sbin/lsof -i | grep $PORT
done
echo "script exection $0 completed"



sushveer
IBM certified specialist-p-series AIX5L System Administration
AIX/SOLARIS/WEBSPHERE-MQ/TIVOLI Administrator
 
Hi bandez

Here is a small script to find any port(listening) versus process

#!/bin/ksh
#script title=/tmp/port-process.ksh
netstat -a|grep LISTEN|awk '{print $4}'>/tmp/port.list
for PORT in `cat /tmp/port.list`
do
/usr/sbin/lsof -i | grep $PORT
done
echo "script exection $0 completed"

This is tested and works fine..No probs!




sushveer
IBM certified specialist-p-series AIX5L System Administration
AIX/SOLARIS/WEBSPHERE-MQ/TIVOLI Administrator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top