Tip #4
20/8/2019
-
Tip
How to detect which process is using a particular TCP port
-
- The following are ways that you can use to find out which process is using a particular
TCP port depending on your platform.- Windows
C:\Program Files\IBM\SQLLIB\BIN>netstat -ano | find "50000" TCP 0.0.0.0:50000 0.0.0.0:0 LISTENING 3332 TCP [::]:50000 [::]:0 LISTENING 3332
- Linux
As root user, issue "netstat -anp" or fuser:yaba:/opt/ibm/db2/V9.7/instance # netstat -anp|grep 60015 tcp 0 0 0.0.0.0:60015 0.0.0.0:* LISTEN 5948/db2sysc 0 db2v10@yaba:/home/db2v10> fuser 60015/tcp 60015/tcp: 5948
- AIX
As root user, use lsof:# /usr/sbin/lsof -i :61001
If you don't have lsof installed:# cat port.sh if [[ $# -ne 1 ]]; then echo $0 PORTNUM exit 1 fi TCPCB=`netstat -Aan|grep $1|awk '{print $1}'` echo "sockinfo $TCPCB tcpcb"|kdb # ./port.sh 60888 ... SLOT NAME STATE PID PPID ADSPACE CL #THS pvproc+090800 578*db2sysc ACTIVE 242006E 26C007A 00000009658D7510 0 000E # echo "hcal 242006E"|kdb|grep -i value Value hexa: 0242006E Value decimal: 37879918
- The following are ways that you can use to find out which process is using a particular