Linux processes that become unresponsive or consume a lot of resources may need to be killed. All processes have their own methods of shutting down. On occasion, processes can malfunction and not shut down properly. When a background process is unresponsive, a command must be used to terminate it. Be sure to consider permissions before terminating or killing a process.
All processes can be terminated by a root user. Adding sudo before a command will run it as root, or you can obtain a root shell using su. Once that's done, run the command. The process that is being killed will receive a termination message.
Among the different types of termination messages are:
The SIGKILL command is the ultimate method of terminating a process. A process is always killed abruptly, generating a fatal error. Normally, SIGKILL always works. If it does not, there is something wrong with the operating system.
It attempts to terminate a process, but unlike SIGKILL, it could be blocked or handled in some other way. In this way, a process can be terminated in a more gentle manner.
When it comes to most purposes, SIGKILL will be the quickest and most efficient way to terminate the process.
Get a complete overview of the currently running processes with the top command. In addition to the process IDs and users, the top command will reveal how much memory and CPU power each process is using. Press k and enter the process ID directly into the top interface to kill processes. Press q to exit the top interface.
ps <options>
A common option to add to this is "-aux":
-a :
Displays processes of all users, rather than only that of the current user.-u :
Displays detailed information regarding each process.-x :
Include processes that are not controlled by users, but by daemons.When the kill command is used, it will kill one process at a time according to the given process ID. A SIGTERM signal will be sent to the process indicating that it must stop. The program will then run its shutdown routine.