3

You often pass options to CLI commands which cause the function to behave differently. They all have a meaning, for example

  • -v means "Verbose"
  • -l means "List"

The ps command lists all running processes, but if you pass it the -aux option, it displays processes from all users, including root.

So my question is: What does the -aux argument of the ps command stand for?

  • 1
    Try man ps, but I believe a == all processes, x == all processes own by user but with a == all processes for all u == all user in userlist. – George Udosen May 1 '17 at 22:53
4

From man ps, the manual page of the ps command (excerpts only):

   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.


   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.


   u      Display user-oriented format.

So the a argument lets ps show processes of all users instead of only the current user, if the processes are connected to a terminal.

The x makes ps also include processes which are not connected to any terminal in the list. So the ax together causes ps to list all processes without restriction.

The u simply changes the output formatting and visible columns.


As @steeldriver mentioned correctly in his comment, ps is a bit special because it supports both arguments in BSD style (a) and GNU style (-a). Therefore ps aux is not exactly the same as ps -aux, although it may be implemented to do the same for easier migration. The relevant paragraph of the man page says:

   Note that "ps -aux" is distinct from "ps aux".  The POSIX and UNIX
   standards require that "ps -aux" print all processes owned by a user
   named "x", as well as printing all processes that would be selected by
   the -a option.  If the user named "x" does not exist, this ps may
   interpret the command as "ps aux" instead and print a warning.  This
   behavior is intended to aid in transitioning old scripts and habits.
   It is fragile, subject to change, and thus should not be relied upon.
| improve this answer | |
  • @steeldriver You're right, thanks. I added that. – Byte Commander May 1 '17 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.