killall and kill commands are used to terminate the running applications on the system. These commands terminate the processes by taking the name or process ID as an argument. Let’s discuss the two distinct Linux kill and killall commands.
What is killall Command in Linux
killall is the Linux tool used to terminate the running process based on the name of the process and its attributes. This tool terminates the running application forcefully. It is the easiest method of killing all the processes in Linux. It will send a TERM signal by default; here is the syntax for using it:
What is kill command
The kill command is the shell command which terminates the process based on the process ID.
Use killall and kill commands to stop processes on Linux, here is the syntax for using it:
How to Use killall Command on Linux to Stop Processes
The ps aux is the simplest way of getting the complete overview of the currently running processes:
The killall command is used to close all the running processes by name by sending the SIGTERM signals. For illustration here I have killed a player called Hypnotix using the killall syntax stated previously:
How to Use kill Command on Linux to Stop Processes
To terminate the process via the kill command you first need to find the process ID. The ps aux command returns the list or running processes with their PIDs. The following Linux command returns the process ID of the specific process:
To get the process ID of Hypnotix use the below command:
kill command kills the process by taking a process ID. The kill command in Linux does not terminate the running process directly, it sends the SIGTERM signals to the application. The SIGTERM is the gentle way of terminating the process. Here -15 is the SIGTERM signal for terminating the process.
To kill the hypnotix process with -15 SIGTERM, use:
Bottom Line
When the process is Linux cannot be closed manually, you can terminate it via the command line. To terminate the process, you must find running processes and their Process ID using the ps aux and pgrep commands. After finding the IDs use the kill and killall commands in the terminal on Linux. The killall is the Linux tool that ends the session of the process based on name and the kill command exits the by taking the process ID as an argument.