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: :::* 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/ -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 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 .

No comments:

Post a Comment