Killing process in linux system
To terminate a process, we need to send it a signal with the kill command.
We do that using the command.
There are many types of signal, the default signal it to terminate the process ID. We can send different signals by adding extra options to the kill command. So just say i need to just STOP the process, and not terminate the process, then i will add the STOP signal to the kill command.
kill -STOP <pid>
The above pid will not be terminated, but will be there in the system memory, waiting for us to continue the process using the command option CONT, so to continue the process that was stopped, run the command.
kill -CONT <pid>
kill - terminate a process
kill [ -s signal | -p ] [ -a ] [ -- ] pid ... kill -l [ signal ]
The command kill sends the specified signal to the specified process or process group. If no signal is specified, the TERM signal is sent. The TERM signal will kill processes which do not catch this signal. For other processes, it may be necessary to use the KILL (9) signal, since this signal cannot be caught.
Most modern shells have a builtin kill function, with a usage rather similar to that of the command described here. The ‚-a‚ and ‚-p‚ options, and the possibility to specify pids by command name is a local extension.
The default signal for kill is TERM. Use -l or -L to list available signals. Particu‚larly useful signals include HUP, INT, KILL, STOP, CONT, and 0. Alternate signals maybe specified in three ways: -9 -SIGKILL -KILL. Negative PID values may be used to choose whole process groups; see the PGID column in ps command output. A PID of -1 is special; it indicates all processes except the kill process itself and init.