Bash Man Page: kill <pid> vs kill -9 <pid>

kill just sends a signal to the given process. The -9 tells it which signal to send.

Different numbers correspond to different common signals. SIGINT, for example, is 2, so to send a process the SIGINT signal issue the command

$ kill -2 <pid>

The manpage here specifies:

The default signal for kill is TERM.

The manpage also provides a table of signals you can send. According to this table, TERM is 15, so these are all equivalent:

kill <pid>
kill -15 <pid>
kill -TERM <pid>

Notice 9 is the KILL signal.

   Name   Number  Action
   -----------------------
   ALRM      14   exit
   HUP        1   exit
   INT        2   exit
   KILL       9   exit  this signal may not be blocked
   PIPE      13   exit
   POLL           exit
   PROF           exit
   TERM      15   exit     [Default]
   USR1           exit
   USR2           exit
   VTALRM         exit
   STKFLT         exit  may not be implemented
   PWR            ignore    may exit on some systems
   WINCH          ignore
   CHLD           ignore
   URG            ignore
   TSTP           stop  may interact with the shell
   TTIN           stop  may interact with the shell
   TTOU           stop  may interact with the shell
   STOP           stop  this signal may not be blocked
   CONT           restart   continue if stopped, otherwise ignore
   ABRT       6   core
   FPE        8   core
   ILL        4   core
   QUIT       3   core
   SEGV      11   core
   TRAP       5   core
   SYS            core  may not be implemented
   EMT            core  may not be implemented
   BUS            core  core dump may fail

   XCPU           core  core dump may fail
   XFSZ           core  core dump may fail

The default signal is TERM which allows the program being killed to catch it and do some cleanup before exiting. A program can ignore it, too, if it's written that way.

Specifying -9 or KILL as the signal does not allow the program to catch it, do any cleanup or ignore it. It should only be used as a last resort.

To see the list of numbers and signal names in Bash, use kill -l (letter ell).