Linux includes ‘kill,’ ‘pkill,’ and ‘killall’ commands designed to terminate processes. You can enter one or more process IDs, names, or ports for termination. This article shows how to efficiently terminate both responsive and unresponsive application processes.
Kill Command Usage Examples:
First we need to know the Process ID of a process to kill any process. Every time a program starts, automatically a unique PID is generated for that process in your Linux system. Run below command in the terminal app (ctrl+alt+t) to find the process PID first.
ps -A
Here now i want to kill the gedit app. For me the gedit PID is 2185033
[OR]
You can also find the PID using the correct process name like below
pidof gedit
Kill Process Using Kill:
Now the kill the gedit process using below command.
kill 2185033
PKill Command Usage Example:
Using Pkill command you can kill a process using the process name like below command. Open gedit app and run below command to kill it.
pkill gedit
Killall Command Usage Example:
If a process has too many instances and child processes, then you can use killall command to kill that.
killall gedit
In this way you can kill a process using kill, Pkill and Killall commands.