Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

About and ps and aux

What does it mean when ps followed by aux. and what is ps when is just by it self.

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

The "aux" part is extra options for the ps command. Without them, ps just uses a default. Each letter stands for a particular option:

  • a - Show all users' processes, not just you own
  • u - Display in a more verbose format, called "user oriented". This gives more details about processes than the default.
  • x - Show processes that aren't attached to a "tty", aka a command shell or similar. This will include all background processes running.
Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Aliayub,

Further to Seth's answer, the ps command (short for "process status") is a Unix command to display running processes. You can see a fuller explanation, together with a guide for all the options to the command by reviewing the manual (available by typing man ps in your terminal).

As for the aux, like Seth explained, these are some of the options that can be applied when executing ps.

Depending on your familiarity with Unix and Unix-like systems, you might not have seen options combined like this before (in this case using BSD syntax). Most Unix commands allow you to string together options, provided that the option takes no arguments.

In practical terms, running ps with no options will just show you the processes that your user owns and are attached to the current terminal session. Here's an example output:

$ ps
  PID TTY       TIME CMD
30512 pts/1 00:00:00 bash
30755 pts/1 00:00:00 ps

This is usually quite a short list and is very convenient for checking for processes that you know were started by you in the current session.

However, often you are also interested in all the processes running on the system, regardless of who started them or which session they were started in (or if they weren't started from a terminal session at all). In such cases you can add the ax options to show everything:

$ ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:37 /sbin/init
    2 ?        S      0:00 [kthreadd]
    4 ?        I<     0:00 [kworker/0:0H]
    6 ?        I<     0:00 [mm_percpu_wq]
    7 ?        S      0:18 [ksoftirqd/0]
...
30512 pts/1    Ss     0:00 -bash
30750 ?        I      0:00 [kworker/u2:2]
30756 ?        Ss     0:00 sshd: my_user [priv]
30841 ?        S      0:00 sshd: my_user@pts/2
30842 pts/2    Ss+    0:00 -bash
31030 ?        I      0:00 [kworker/u2:0]
31032 pts/1    R+     0:00 ps ax

Generally, if you are in the situation where you are concerned with processes that you didn't start, other pieces of information (such as which user did start the process) become relevant, this is why you almost always see the u option also being used with ax.

Here's the previous command with u added:

$ ps axu
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.5  77892  5876 ?        Ss    2018   0:37 /sbin/init
root         2  0.0  0.0      0     0 ?        S     2018   0:00 [kthreadd]
root         4  0.0  0.0      0     0 ?        I<    2018   0:00 [kworker/0:0H]
root         6  0.0  0.0      0     0 ?        I<    2018   0:00 [mm_percpu_wq]
root         7  0.0  0.0      0     0 ?        S     2018   0:18 [ksoftirqd/0]
...
my_user  30512  0.0  0.8  25824  8196 pts/1    Ss   02:50   0:00 -bash
root     30750  0.0  0.0      0     0 ?        I    02:53   0:00 [kworker/u2:2]
root     30756  0.0  0.7 107984  7180 ?        Ss   02:55   0:00 sshd: my_user [pri
my_user  30841  0.0  0.3 107984  3464 ?        S    02:56   0:00 sshd: my_user@pts/
my_user  30842  0.0  0.8  25824  8236 pts/2    Ss+  02:56   0:00 -bash
root     31030  0.0  0.0      0     0 ?        I    02:59   0:00 [kworker/u2:0]
my_user  31035  0.0  0.3  39664  3628 pts/1    R+   03:03   0:00 ps axu

Hope that helps,

Alex