Q:

Why doesn't ps -al display my java programs?

I don't understand why ps -al or sudo ps -al won't display for instance my java processes. If I do ps -al then I don't see for example my java jobs but I see them when I do the (strange and unrecognized) ps -xal | grep java which probably should be something else. I can also find the java PID by a netstat for the port that the java (jetty server) in running on (port 80), get the PID for the process on port 80 and then kill it by its PID. I doesn't seem like sudo killall java works all the time. Can you help my with a working strategy how to simplify handling the running of 2-3 jetty instances that only sometimes appear when doing ps -al ? I suppose the best way is to stop jetty similarly to the manner in which it is started i.e. sudo mvn jetty:stop but the jetty manual says that it's ok to just kill the process, which is faster. (I often want to restart jetty.)

A:

-a and x are process selectors, So ps will show filtered processes listing.
If you want to see all process use: ps ax , ps -ax or ps -A, even a and -a are not the same. Reference: man ps
SIMPLE PROCESS SELECTION
       a      Lift the BSD-style "only yourself" restriction, which is imposed
              upon the set of all processes when some BSD-style (without "-")
              options are used or when the ps personality setting is BSD-like.
              The set of processes selected in this manner is in addition to
              the set of processes selected by other means.  An alternate
              description is that this option causes ps to list all processes
              with a terminal (tty), or to list all processes when used
              together with the x option.

       -A     Select all processes.  Identical to -e.

       -a     Select all processes except both session leaders (see getsid(2))
              and processes not associated with a terminal.
...

       x      Lift the BSD-style "must have a tty" restriction, which is
              imposed upon the set of all processes when some BSD-style
              (without "-") options are used or when the ps personality
              setting is BSD-like.  The set of processes selected in this
              manner is in addition to the set of processes selected by other
              means.  An alternate description is that this option causes ps
              to list all processes owned by you (same EUID as ps), or to list
              all processes when used together with the a option.

For killing, try with sudo killall -s9 ... . Reference: Kill Commands and Signals

