Super User is a question and answer site for computer enthusiasts and power users. 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 want to see all the java processes & see the details of it in linux.

I'm using top command & it shows me all processes along with java.

But I would like to know if there is any way top command will show only java processes. I've many java programs running in my server & I want the top command to list only java processes so that I can see the details of them.

Is this possible? How can I do it in top command?


share|improve this question

migrated from Jan 9 '12 at 18:39

This question came from our site for professional and enthusiast programmers.

up vote 4 down vote accepted

Install htop, press \, then enter java Enter.

share|improve this answer

Instead of top, use ps and if you want it to be refreshed periodically, use watch. For example:

watch -n 1 'ps aux | grep java'
share|improve this answer
top -p `pgrep -d, -f java`


 top -p pid[,pid,pid]

Provides top a list of pids to watch.

`pgrep -d, -f java`

Does a grep of the process names for 'java', and returns the comma seperated pid values.

share|improve this answer

If you have JDK ( unlikely on production servers) installed, there are set of tools that works with java process. jps/jmap etc

share|improve this answer
jps (as well as jstat,jstatd, and jconsole) is marked as experimental and unsupported in the Java 1.5 documentation. Same thing for jmap and its ilk (jinfo, jsadebugd, and jstack) - in the 1.5 documentation. The Java 7 documentation has identical warnings. – Mei Jan 11 '12 at 20:30

You need to filter output, so you can use 'grep' command, direct 'top' output using a pipeline '|'. So your command should look something like: top | grep java

If you just need to know info in one point of time you can use: ps aux | grep java

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .