[unix] Why number 9 in kill -9 command in unix?

First you need to know what are Signals in Unix-like systems (It'll take just few minutes).

Signals, are software interrupts sent to a (running) program to indicate that an important event has occurred.

The events can vary from user requests to illegal memory access errors. Some signals, such as the interrupt signal, indicate that a user has asked the program to do something that is not in the usual flow of control.

There are several types of Signals we can use - to get a full list of all the available/possible Signals use "$ kill -l" command: enter image description here

In the above output it's clearly visible, that each Signal has a 'signal number' (e.g. 1, 2, 3) and a 'signal name' (e.g. SIGUP, SIGINT, SIGQUIT) associated with it. For a detailed look up what each and every Signal does, visit this link.

Finally, coming to the question "Why number 9 in kill -9 command":

There are several methods of delivering signals to a program or script. One of commonly used method for sending signal is to use the kill command - the basic syntax is:

$ kill -signal pid

Where signal is either the number or name of the signal, followed by the process Id (pid) to which the signal will be sent.

For example - -SIGKILL (or -9), signal kills the process immediately.

$ kill -SIGKILL 1001

and

$ kill -9 1001

both command are one the same thing i.e. above we have used the 'signal name', and later we have used 'signal number'.

Verdict: One has an open choice to whether use the 'signal name' or 'signal number' with the kill command.

Examples related to unix

Docker CE on RHEL - Requires: container-selinux >= 2.9 What does `set -x` do? How to find files modified in last x minutes (find -mmin does not work as expected) sudo: npm: command not found How to sort a file in-place How to read a .properties file which contains keys that have a period character using Shell script gpg decryption fails with no secret key error Loop through a comma-separated shell variable Best way to find os name and version in Unix/Linux platform Resource u'tokenizers/punkt/english.pickle' not found

Examples related to command

'ls' is not recognized as an internal or external command, operable program or batch file Command to run a .bat file how to run python files in windows command prompt? Run a command shell in jenkins How to recover the deleted files using "rm -R" command in linux server? Split text file into smaller multiple text file using command line ansible : how to pass multiple commands Jmeter - Run .jmx file through command line and get the summary report in a excel cocoapods - 'pod install' takes forever Daemon not running. Starting it now on port 5037

Examples related to history

Linux Command History with date and time Original purpose of <input type="hidden">? SecurityError: The operation is insecure - window.history.pushState() Why number 9 in kill -9 command in unix? nginx: send all requests to a single html page What is the origin of foo and bar?

Examples related to kill

How to kill a nodejs process in Linux? What does 'killed' mean when a processing of a huge CSV with Python, which suddenly stops? how to kill hadoop jobs Why number 9 in kill -9 command in unix? How to kill a process on a port on ubuntu How to kill a child process by the parent process? How to kill all processes matching a name? How do I kill an Activity when the Back button is pressed? Terminating idle mysql connections How can I stop a running MySQL query?