James's Ramblings

Linux Process Commands

Created: June 02, 2020

ps

  • By default, it only lists processes attached to the current terminal.
  • ps aux list all processes for all users on all terminals
    • a: lists ll user’s processes which are attached to a terminal
    • u: display in user format
    • x: lists all the invoking user’s processes
  • f: shows processes in a tree view.

ps aux vs ps -aux

There is a difference between ps aux and ps -aux. ps -aux is the Unix variant and ps aux is the BSD variant. From man ps:

“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. Modern Linux distributions might make ps -aux an alias of ps aux; nevertheless this is intended to be a temporary fix.”

ps -aux should be avoided in favour of ps aux.

pgrep

  • pgrep PROCESS outputs the PID of PROCESS.
  • -l outputs the name of the PROCESS in addition to the PID.
  • -u limits the matches to a user.
  • -v inverts the results.

Kill Signals

  • There are 64 kill signals.
  • kill -l will list all kill signals.

pstree

A nice tree view.