Sometimes We may need to know which process or user use a specific port on a unix system.
In this post, I will show you how you can find a port in use or not and who use this port.
Firstly, let us check port in use or not (My server IP is 192.168.1.1)
# netstat -Aan |grep 1158 oracle@myserver:> netstat -Aan |grep 1158 f1000e00008ef3b8 tcp4 0 0 192.168.1.1.1158 192.168.1.35.44718 ESTABLISHED f1000e0001977bb8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.36687 CLOSE_WAIT f1000e0001e83bb8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.36737 CLOSE_WAIT f1000e0001e773b8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.36837 CLOSE_WAIT f1000e00014593b8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.36898 CLOSE_WAIT f1000e0000fb3bb8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37013 CLOSE_WAIT f1000e00235333b8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37072 CLOSE_WAIT f1000e002343a3b8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37176 CLOSE_WAIT f1000e0023418bb8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37244 CLOSE_WAIT f1000e00234163b8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37342 CLOSE_WAIT f1000e0000fbebb8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37399 CLOSE_WAIT f1000e0010200bb8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37497 CLOSE_WAIT f1000e00102383b8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37564 CLOSE_WAIT f1000e0010231bb8 tcp4 29 0 192.168.1.1.1158 192.168.1.1.37676 CLOSE_WAIT
Secondly, let us find which process is using this port
# rmsockf1000e0010231bb8 tcpcb The socket 0x864e808 is being held by proccess 143640 (java).
Thirdly, let us find who use this port
# ps -ef |grep 143640
oracle 143640 127270 0 May 18 – 3:06 /var/opt/tivoli/ep/_jvm/jre/bin/java
Yorum bırakın
Comments feed for this article