Processes

ps

Display all currently active processes.

  1. To get a list of all the processes and their PIDs :
    1. For the current user - ps -ux
    2. For all the users - ps -aux
  2. To get the info of a particular process use ps -C process-name

top

Display Linux processes.

Syntax: top

Example:

$ top
top - 07:37:31 up 52 min,  0 users,  load average: 0.52, 0.58, 0.59
Tasks:   4 total,   1 running,   3 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.4 us, 13.3 sy,  0.0 ni, 83.1 id,  0.0 wa,  1.2 hi,  0.0 si,  0.0 st
KiB Mem :  8276908 total,  3993960 free,  4053596 used,   229352 buff/cache
KiB Swap: 25165824 total, 24881392 free,   284432 used.  4089580 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  221 shathin   20   0   17624   2076   1504 R 100.0  0.0   0:00.03 top
    1 root      20   0    8936    304    260 S   0.0  0.0   0:00.11 init
    7 root      20   0    8936    212    168 S   0.0  0.0   0:00.01 init
    8 shathin   20   0   16784   3428   3316 S   0.0  0.0   0:00.58 bash

Keys that provide functionality within the top window:

htop

Interactive process viewer.

Syntax: htop