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?


5 Answers 5


Install htop, press \, then enter java Enter.


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'
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.


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

  • 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, 2012 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

You must log in to answer this question.

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