Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

Thanks!

share|improve this question

migrated from stackoverflow.com Jan 9 '12 at 18:39

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

add comment

5 Answers 5

up vote 4 down vote accepted

Install htop, press \, then enter java Enter.

share|improve this answer
add comment

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
add comment
top -p `pgrep -d, -f java`

Explanation:

 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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.