I want to see a summary of all 'php-fpm' processes, regardless of the user running them.

As I understand from man ps, it normally only looks at processes your current user started in a terminal. So ps -C php-fpm never yields any results. However the man page seems to suggest that the only way to lift the restrictions is by using something like ax but that this adds all processes in to the results, as well as any that match the filters.

Is the only way to do a big ps then use grep? I'm sure I must have missed something?

I'm using Debian Linux's ps which, according to the man page, confirms to:

  1. Version 2 of the Single Unix Specification
  2. The Open Group Technical Standard Base Specifications, Issue 6
  3. IEEE Std 1003.1, 2004 Edition
  4. X/Open System Interfaces Extension [UP XSI]
  5. ISO/IEC 9945:2003

3 Answers 3


You need to match the command name exactly:

ps -fC php-fpm7.0

(on Debian 9).

ps -C

doesn’t restrict itself to the current user’s processes, but it doesn’t match substrings of the command names.

  • On mine, the command is shown as php-fpm: pool foo yet ps -fC 'php-fpm: pool foo does not give any results. But doing as you suggest does work - how did you know the command was not that which is shown in the "command" column? Apr 24, 2018 at 16:22
  • 1
    ps -C matches the COMMAND (-o comm) column, not the CMD column which is what ps -f shows. This corresponds to the contents of /proc/${pid}/comm, which is usually the name of the binary (php-fpm7.0 in this case, as revealed by dpkg -L). Apr 24, 2018 at 16:32

Use pgrep to get a list of PIDs to pass to ps:

pgrep php-fpm | xargs ps xu

If you have pgrep installed, then

pgrep php-fpm

would output the process IDs of all commands matching php-fpm. To also see the command, add -l.

If php-fpm is part of the command line and not the actual command itself, add -f to the pgrep invocation. With -lf, pgrep would display the full command line used.

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.