Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed a package called opengeo-suite which installs tomcat 6 if it is not installed. Now I have apache 2.2 running on port 8080. I wish to find out on which port is the tomcat 6 running on? What is the command to find that out?


Also how do I identify whether it is up and running?

share|improve this question
up vote 13 down vote accepted

If you use

$ ps -ef


$ top

you should be able to find the PID (Process ID) for your opengeo-suite.

With the PID in hand, you can use netstat and grep to find out what port it's running on. For example, I can see the PID of my tomcat is 1483. So using,

$ sudo netstat -lnp | grep 1483

I get the result:

tcp6       0      0 :::8080                 :::*                    LISTEN      1483/java       
tcp6       0      0          :::*                    LISTEN      1483/java 

I don't think you asked this, but for completeness, to find the process ID when you know port number:

$ sudo lsof -i:8080 -n


java    1483 tomcat6   36u  IPv6   3496      0t0  TCP *:http-alt (LISTEN)

Note, netstat and lsof will run without sudo, but they won't show all ports. In my case, sudo was necessary to see the tomcat ports.

share|improve this answer
thanks that solved the problem – Sam007 May 29 '12 at 18:53
I like that find-process-from-port trick! Very helpful! – jhaagsma Apr 29 at 19:36

By default it runs on port 8080

You can scan your ports and other's ports by using "nmap"

For your own machine:

nmap localhost
share|improve this answer
For your local machine netstat would be much easier and faster. Read the man page on how to connect the name of the program that opens the port to the output. man netstat is one of your friends here:-) – ohno May 29 '12 at 18:48
Thanks a lot ohno, It has a very good and friendly manual. – Mohammad Etemaddar May 30 '12 at 13:27

Try the below:

netstat -ntpl | grep java
tcp        0      0**8005***               LISTEN      2710/java
tcp        0      0**8008**  *               LISTEN      2710/java
tcp        0      0**8009**  *               LISTEN      2710/java
share|improve this answer
Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details what is this supposed to do and why. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) – David Foerster Feb 29 at 17:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.