What is the difference between kill, pkill and killall?
BeginnerConceptProcesses, Signals & systemd
Answer
kill -TERM 1234 # by PID
pkill -HUP -f 'gunicorn: master' # by pattern match on name or full cmdline (-f)
killall nginx # by exact process name
pgrep -a java # preview what would match
On Linux killall matches names; on Solaris it killed everything, a famous trap. Always preview with pgrep before pkill.
More on Processes, Signals & systemd
What is the difference between a program, a process and a thread?BeginnerHow are new processes created in Linux?IntermediateWhat is a zombie process, and how do you get rid of it?IntermediateWhat is an orphan process?BeginnerExplain the process states shown in ps (R, S, D, T, Z).IntermediateWhy can't you kill a process in D state?Advanced