LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2010, 11:25 PM   #1
nishanthame
LQ Newbie
 
Registered: Mar 2010
Location: Colombo
Distribution: Ubuntu and Cent OS
Posts: 9

Rep: Reputation: 2
How to find the port of particular application.


Hi all

How do I find the port which is used by a particular application ?. And how do I terminate that process?

Thank

Nishantha
 
Old 06-21-2010, 11:38 PM   #2
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
Quote:
Originally Posted by nishanthame View Post
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>

Last edited by pinga123; 06-21-2010 at 11:46 PM.
 
1 members found this post helpful.
Old 06-21-2010, 11:40 PM   #3
kumar.manoj412
Member
 
Registered: May 2007
Location: India
Distribution: Mandriva, Ubuntu
Posts: 43
Blog Entries: 1

Rep: Reputation: 16
Hi Nishantha,

'netstat' is the command to find the port no. of a running applications.
#netstat -ta (for tcp port)
#netstat -ua (for udp port)

you can terminate a process by executing the following command
# kill pid (replace pid with the original pid of your process.)



Quote:
Originally Posted by nishanthame View Post
Hi all

How do I find the port which is used by a particular application ?. And how do I terminate that process?

Thank

Nishantha
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C under Linux -Trying to write two port server and 2 port client application NancyT Linux - Server 3 04-17-2009 02:05 AM
How do you find an application using launch application pnoise Linux - Newbie 1 01-11-2009 10:44 PM
Application Port Conflict lramirez Linux - Server 1 09-30-2006 04:00 PM
Port forwarding Application edman007 Solaris / OpenSolaris 5 09-08-2006 01:59 AM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 08:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration