Selected topic
Process Management
Prefer practical output? Use related tools below while reading.
In Linux, a process is an instance of a program that is running. The kill command is used to send signals to processes, which can be used to terminate, stop, or suspend them.
kill [options] <process_id>$ kill 1234This will send a SIGTERM signal to the process, which is the default signal sent by kill. The process will be terminated if it doesn't exit on its own within a short period of time.
$ kill 1234 5678 9012This will send the same signal to all three processes.
kill command has several options that allow us to specify the type of signal to be sent. Here are a few examples:-9 or SIGKILL: This is a stronger signal than SIGTERM and cannot be caught by the process. It will terminate the process immediately, without giving it a chance to exit cleanly.-15 or SIGTERM: This is the default signal sent by kill. It tells the process that it should exit, but gives it a chance to clean up before doing so.$ kill -9 1234This will send a strong signal to the process, which cannot be caught or ignored. The process will be terminated immediately.
In summary, the kill command is used to terminate processes by sending signals to them. We can specify the type of signal to be sent using options like -9 for SIGKILL or -15 for SIGTERM.