258

ps aux seems to conveniently list all processes and their status and resource usage (Linux/BSD/MacOS), however I cannot comprehend the meaning of parameter aux using man ps.

What does aux mean?

Howard
  • 5,209

4 Answers4

319

a = show processes for all users
u = display the process's user/owner
x = also show processes not attached to a terminal

By the way, man ps is a good resource.

Historically, BSD and AT&T developed incompatible versions of ps. The options without a leading dash (as per the question) are the BSD style while those with a leading dash are AT&T Unix style. On top of this, Linux developed a version which supports both styles and then adds to it a third style with options that begin with double dashes.

All (or nearly all) non-embedded Linux distributions use a variant of the procps suite. The above options are as defined in the procps ps man page.

In the comments, you say you are using Apple MacOS (OSX, I presume). The OSX man page for ps is here and it shows support only for AT&T style.

John1024
  • 74,655
  • According to my manual page (MacOS), u means "Display the processes belonging to the specified usernames" – Howard Dec 28 '13 at 05:18
  • 1
    @HowardGuo Are you sure that isn't -u as opposed to just u? – jordanm Dec 28 '13 at 05:26
  • @jordanm In this manual page, there is not any explained option without leading dash, I am afraid. – Howard Dec 28 '13 at 05:28
  • 2
    @HowardGuo I have updated the answer to reflect the differences between the GNU (Linux) version of ps and the Apple OSX version. This question is currently tagged "Linux". If you are asking also about MacOS, you might want to update the tags. – John1024 Dec 28 '13 at 06:55
  • 1
    Thanks very much. I just checked manual page of ps in Linux and it has information regarding aux, MacOS' manual page does not have such information, it might be a document bug. – Howard Dec 28 '13 at 09:28
  • 5
    OSX man page for ps does say "... ps aux still works as it did in Tiger" under "Legacy Description" section. – dev Oct 24 '15 at 15:23
  • 1
    @dev the whole paragraph reads: The biggest change is in the interpretation of the -u option, which now displays processes belonging to the specified username(s). Thus, "ps -aux" will fail (unless you want to know about user "x"). As a convenience, however, "ps aux" still works as it did in Tiger. – Jules Aug 05 '16 at 14:23
  • 12
    I have to object to the comment that "man ps is a good resource on mac OSX. The man page, only at the very end, notes that ps aux is maintained as a convenience, but there is absolutely no hint that options may be specified without leading hyphens before the end, the man page is long and richly complex, and a reader can spend a lot of time questioning his/her sanity before giving up and googling for this stackexchange question. – Reb.Cabin Jan 13 '18 at 23:31
27

man ps describes these options as follows:

   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.

u Display user-oriented format.

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.

Example

$ ps aux | head -10
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  51120  2796 ?        Ss   Dec22   0:09 /usr/lib/systemd/systemd --system --deserialize 22
root         2  0.0  0.0      0     0 ?        S    Dec22   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Dec22   0:04 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   Dec22   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    Dec22   0:15 [migration/0]
root         8  0.0  0.0      0     0 ?        S    Dec22   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    Dec22   2:47 [rcu_sched]
...
saml      3015  0.0  0.0 117756   596 pts/2    Ss   Dec22   0:00 bash
saml      3093  0.9  4.1 1539436 330796 ?      Sl   Dec22  70:16 /usr/lib64/thunderbird/thunderbird
saml      3873  0.0  0.1 1482432 8628 ?        Sl   Dec22   0:02 gvim -f
root      5675  0.0  0.0 124096   412 ?        Ss   Dec22   0:02 /usr/sbin/crond -n
root      5777  0.0  0.0  51132  1068 ?        Ss   Dec22   0:08 /usr/sbin/wpa_supplicant -u -f /var/log/wpa_supplica
saml      5987  0.7  1.5 1237740 119876 ?      Sl   Dec26  14:05 /opt/google/chrome/chrome --type=renderer --lang=en-
root      6115  0.0  0.0      0     0 ?        S    Dec27   0:06 [kworker/0:2]
...

With the above switches you'll get output regarding your processes like above.

The switches aux will show you:

  • all the users' processes
  • show you the process listed in a user oriented fashion (by user names)
  • show you all processes, not just ones attached to a terminal. This will include processes such as services like crond, upowerd, etc.
Stephen Kitt
  • 434,908
slm
  • 369,824
11

The key to understanding the manpage is not to search for "aux" (which I tried first), but to focus on the section that describes the kinds of parameter ps takes:

This version of ps accepts several kinds of options:

  1. UNIX options, which may be grouped and must be preceded by a dash.
  2. BSD options, which may be grouped and must not be used with a dash.
  3. GNU long options, which are preceded by two dashes.

From this, we know that aux is a set of (grouped) BSD options, a, u and x, which makes them slightly easier to look up.

  • a and x control which processes are selected, and used together are explicitly described to select all processes.

  • u outputs using the "user-oriented" format, which gives more columns, including the user id and CPU/memory usage.

Because u alone controls the output format, you can get "ps aux" style output just for specific processes with ps u $pid1 $pid2 ....

mwfearnley
  • 1,126
0

ps: process status

for me, both /bin/ps --version and /usr/bin/ps --version gets: ps from procps-ng 3.3.16

ps is a command provided by procps:
Command line and full screen utilities for browsing procfs, a "pseudo" file system dynamically generated by the kernel to provide information about the status of entries in its process table.

2 kinds of syntax

To see every process on the system using:

  1. standard syntax
  • ps -e
  • ps -ef

BTW, example of ps -u:

  • ps -u root --format=user,pid,command # which is same as this line:
  • ps -uroot --format=user,pid,command #(What an ugly syntax!)

output is:

    USER         PID COMMAND
    root           1 /sbin/init splash
    root           2 [kthreadd]
    root           3 [rcu_gp]
    root           4 [rcu_par_gp]
    root           6 [kworker/0:0H-kblockd]
    root           9 [kworker/u80:0-ixgbe]

By this POSIX and UNIX standards, ps -aux means ps -a -ux , printing:
1. processes with tty (except session leaders) [by -a]
2. all processes owned by a user named "x" [by -ux] (-u: select processes by effective user)

Process selection options are additive (A process will be shown if it meets any of the given selection criteria)

If the user named "x" (the current user?) does not exist, ps -aux may fall to ps aux , and print a warning

there is no -x option in manpage, but ps -x can find the same processes as ps -ux, (in a different output format)

  • ps -ux --format=user gets:
    username does not exist
  • ps -x --format=user
    gets proper results (corespond to the current user)

no wonder manpage reminds:

This behavior is intended to aid in transitioning old scripts and habits. It is fragile, and thus should not be relied upon


  1. BSD syntax:
    ps ax
  • a: all users

  • x: list all processes owned by you (same EUID as ps). Or more concretely, include processes with no controlling terminal (include processes not attached to a terminal).

    so, ax will list all processes

  • u: output in resource usage format
    exampale: ps axu


This scene shows the convinience of zsh' s autocomplete (press tab and get hint) enter image description here

enter image description here

This manpage is reader friendly: https://www.mankier.com/1/ps

Good Pen
  • 205