How to find which application is using the PORT in Linux ?

Let's see an example to find which application is using the PORT number 9000.
We will be using the netstat command , which is a network statistics command line utility.

Find the process PID and name :

[[email protected] ~]# netstat -nlp | grep :9000
tcp   0   0   0.0.0.0:9000   0.0.0.0:*   LISTEN   18347/java

Above command netstat combined with grep gave us the filtered result which says process namely java with PID 18347 is using the port number 9000.

Command Line related to process :

Following is the command to get the command line information related to above process.

[[email protected] ~]# xargs -0 < /proc/18347/cmdline
/usr/java/jre1.8.0_181-amd64/bin/java -Dproc_namenode -Xmx1024m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/opt/ca/hadoop-2.9.1/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/opt/ca/hadoop-2.9.1 -Dhadoop.id.str= -Dhadoop.root.logger=INFO,console 
-Djava.library.path=/opt/ca/hadoop-2.9.1/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true 
-Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/opt/ca/hadoop-2.9.1/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/opt/ca/hadoop-2.9.1 -Dhadoop.id.str= -Dhadoop.root.logger=INFO,console -Djava.library.path=/opt/ca/hadoop-2.9.1/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender 
-Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.hdfs.server.namenode.NameNode
 

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

www.000webhost.com