Here's a preview from my zine, Bite Size Command Line!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
kill doesn’t just kill programs
you can send ANY signal to a program with kill!
$ kill -SIGNAL PID
(name or number)
which signal kill sends
name num
kill => SIGTERM 15
kill -9 => SIGKILL 9
kill -KILL => SIGKILL 9
kill -HUP => SIGHUP
kill -STOP => SIGSTOP
kill -l lists all signals.
- HUP
- INT
- QUIT
- ILL
- TRAP
- ABRT
- BUS
- FPE
- KILL
- USR1
- SEGV
- USR2
- PIPE
- ALRM
- TERM
- STKFLT
- CHLD
- CONT
- STOP
- TSTP
- TTIN
- TTOU
- URG
- XCPU
- XFS2
- VTALRM
- PROF
- WINCH
- POLL
- PWR
- SYS
killall -SIGNAL NAME
signals all processes called NAME
for example:
$ killall firefox
useful flags:
-w: wait for all signaled processes to die
-i: ask before signalling
pgrep
prints PIDs of matching running programs
pgrep fire matches firefox firebird
NOT bash firefox.sh
To search the whole command line (eg bash firefox.sh), use pgrep -f
pkill
same as pgrep, but signals PIDS found. Example:
$ pkill -f firefox
I use pkill more than killall these days.
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!