Process Control
kill
Sends a signal to a process id.
Use
kill -s <signal> <pid> send <signal> (SIGTERM if not defined) to <pid>
Useful Flags
-L display list of signals
Most Important Signals
SIGINT / 2 INTERRUPT (Same as Ctrl+c) cancel a running process
SIGKILL / 9 kills process
SIGTERM / 15 terminates a program cleanly
SIGSTOP / 17 stops a running foreground process (Same as Ctrl-z)
SIGCONT / 18 continues a stopped process
pkill
Sends a signal to a process name.
Use
pkill -s <signal> <pattern> send <signal> to all processes matching <pattern>
Useful Flags
-x, --exact process name must match exactly
killall
Almost the same as pkill.
Use
killall -s <signal> <pattern> send <signal> to all processes matching <pattern>
Useful Flags
-e, --exact process name must match exactly
pgrep
Find PID from pattern.
Use
pgrep <pattern> display process ids matching <pattern>