Rod Hilton's rants about software development, technology, and sometimes Star Wars

Listing Only Java Processes

Ever do something like the following?

$ ps aux | grep 'java'

Pretty annoying, especially considering that the output usually shows the enormous startup script commands running with Java. Wouldn’t it be nice if you could just run a command that would list only java processes, and specifically list what the actual application running within the VM is?

As I learned at a JUG last night, there IS a program that will do this. It’s called ‘jps’.

JPS will list only the java processes running, with their actual PIDs and the shortened names of the entry classnames or jar files. This lets you handily see what is actually running:

18027 Java2Demo.JAR
18032 jps
18005 jstat

Where can you get this amazing tool? You already have it! It’s part of the JDK, apparently. Go to a terminal and type ‘jps’ and check it out.

The program also takes options to list full classnames and it can even connect to a remote machine and list JVMs remotely.

How did I not know about this? It rocks my face off.

comments powered by Disqus