Search code examples
unixgoogle-cloud-platform

What does ps auwx | grep nginx mean?


I got the below output but I want to know what does ps auwx do?

root      2257  0.0  0.0 159532  1628 ?        Ss   06:07   0:00 nginx: master process /usr/sbin/nginx -g daemon on
; master_process on;
www-data  2258  0.0  0.1 159864  3380 ?        S    06:07   0:00 nginx: worker process
root      2280  0.0  0.0  12780   952 pts/0    S+   06:08   0:00 grep nginx

Solution

  • As with all things Linux/Unix the man pages are your friend: man ps, man grep

    auwx are bsd style parameters (note the lack of an -) and the manual states that these letters represent the following options:

    • a lift 'only yourself' restriction -> list all processes with a terminal.
    • u 'user format' -> provides additional information columns.
    • w wide output -> for when you have a screen wide enough to show all info.
    • x lift 'must have terminal' restriction -> a+x == list everything.

    The output is then piped through to grep which then filters out the line and displays any lines with nginx in it.