# Kill-pid
Note: a standard kill command usually achieves its purpose. Terminate the problematic process and release the resources of the process to the system. However, if a process starts a child process and kills only the parent process, the child process is still running and therefore consumes resources. To prevent these so-called "zombie processes," Be sure to kill all of their child processes before killing the parent process.
Determine the PID or ppid to kill the process
# Ps-ef | grep httpd
End the process in an elegant way
# kill-l PID
The-l option tells the kill command to end the process in a way that appears to the user who started the process logged off. When this option is used, the kill command also attempts to kill the left child process. But this command is not always successful – you may still need to manually kill the child process before killing the parent process.
Term signal
Sends a term signal to the parent process, attempting to kill it and its child processes.
# kill-term PPID
Killall command
The killall command kills all processes within the same process group. It allows you to specify the name of the process to terminate, not the PID.
Killall httpd
Stopping and restarting a process
Sometimes you just want to simply stop and restart the process. As follows:
# Kill-hup PID
This command shuts down the Linux gentle execution process and then restarts immediately. This command is handy when configuring the application, which can be executed when the configuration file is modified to restart the process.
Lore Kill-9 PID
Consent of the Kill-s SIGKILL
This powerful and dangerous command forces the process to terminate abruptly at run time, and the process cannot clean itself up after the end. A hazard is a system resource that is not normally released, and is generally not recommended unless other methods are invalid.
When using this command, be sure to confirm with ps-ef that there are no zombie processes left. The zombie process can be eliminated only by terminating the parent process. If the zombie process is adopted by INIT, the problem is more serious. killing the init process means shutting down the system .
If there is a zombie process in the system, and its parent process is init, and the zombie process consumes a lot of system resources, then you need to restart the machine at some point to clear the process table.
How Linux kills a process