Search This Blog

Wednesday, July 6, 2011

How to find the port of particular application?

Question : How do I find the port which is used by a particular application ?
Answer :
Consider Tomcat application is running on port 8080.
To check whether the Tomcat is running or not.

Initially you need to understand the output presented by
netstat -ntpl .
In above case Tomcat is using java as their process so i grep with java. Your application might be using different name.

#netstat -ntpl | grep java
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 6375/java
tcp 0 0 :::8009 :::* LISTEN 6375/java
tcp 0 0 :::8080 :::* LISTEN 6375/java

You should see at least one java process and you can use ps to identify if this is Tomcat.

# ps -ef | grep 6375
root 6375 1 0 May18 pts/2 00:01:06 /usr/java/jdk1.6.0_20/bin/java -Djava.util.logging.config.file=/install/apache-tomcat-5.5.29/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/install/apache-tomcat-5.5.29/common/endorsed -classpath /install/apache-tomcat-5.5.29/bin/bootstrap.jar -Dcatalina.base=/install/apache-tomcat-5.5.29 -Dcatalina.home=/install/apache-tomcat-5.5.29 -Djava.io.tmpdir=/install/apache-tomcat-5.5.29/temp org.apache.catalina.startup.Bootstrap start
root 9222 5091 0 18:29 pts/2 00:00:00 grep 6375

for killing the process just use.
kill -9

The above article is with reference to my question posted on below forum .
http://www.linuxquestions.org/questions/showthread.php?p=4010963&posted=1#post4010963

No comments:

Post a Comment