Quote:
Originally Posted by nishanthame
Hi all
How do I find the port which is used by a particular application ?. And how do I terminate that process?
Thank
Nishantha
|
To make things simpler i m giving you an example where my Tomcat application is running on my server. It is using port 8080.
To check whether the Tomcat is running or not.
Initially you need to understand the output presented by
netstat -ntpl .
In my 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 <process_id>