The most common reason behind wanting to know a process ID is to pass this information to the kill
command. The process ID does have other uses, but our primary concern is to remove a problematic service or application by issuing a termination signal (SIGTERM
) to the relevant daemon as follows:
# kill pid_of_process
The kill
signal instructs the process to terminate, thereby enabling the process in question to perform some basic cleanup operations and exit in an orderly fashion. This approach is known as a "safe kill". However, depending on your situation, a better solution can be to force a service or application to hang up, and thereby enable an automatic reload of the daemon as follows:
# kill -1 pid_of_process
This command is known as a SIGHUP
or hangover
command. On the other hand, if the process has seemingly crashed, and a safe kill or reload operation fails to make any difference, then by passing the following command, you will be able to literally kill the...