Skip to content

Theme color

Processes

Command Effect
ps aux All processes with CPU, memory and command line.
ps -ef --forest All processes as a tree of parents and children.
pgrep -a nginx PIDs and command lines of processes matching a name.
htop Interactive viewer; F6 sorts, F9 sends a signal.
kill <pid> Asks a process to terminate (SIGTERM).
kill -9 <pid> Kills it immediately (SIGKILL).
pkill nginx Sends SIGTERM to all processes matching a name.
nice -n 10 cmd Starts a command with lower priority.
renice -n 10 -p <pid> Lowers the priority of a running process.
Signal Number Default effect
SIGHUP 1 Terminate. Many daemons reload their configuration instead.
SIGINT 2 Terminate; sent by Ctrl+C.
SIGKILL 9 Terminate immediately. Can’t be caught, so no cleanup happens.
SIGTERM 15 Terminate cleanly. The default of kill.
SIGSTOP 19 Pause; Ctrl+Z sends the similar SIGTSTP.
SIGCONT 18 Continue a paused process.
stateDiagram-v2
  direction LR
  Foreground --> Stopped: Ctrl+Z
  Stopped --> Background: bg
  Stopped --> Foreground: fg
  Background --> Foreground: fg
  [*] --> Background: cmd &
Command Effect
cmd & Starts a command in the background.
jobs Lists the jobs of the current shell.
bg %1 Continues job 1 in the background.
fg %1 Brings job 1 to the foreground.
disown %1 Detaches a job so it keeps running when the shell is closed.
nohup cmd & Starts a command that ignores the hangup when you log out.