Difference between revisions of "Process Control"
| Line 7: | Line 7: | ||
== Useful Flags == | == Useful Flags == | ||
<code>- | <code>-l</code> display list of signals</br> | ||
== Most Important Signals == | == Most Important Signals == | ||
Latest revision as of 17:00, 30 November 2022
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>