Sometimes, applications on a Linux server may become unresponsive or consume excessive CPU and memory. In such cases, it's helpful to identify and terminate the problematic process to stabilize system performance.
This article explains how to locate and terminate a process in Linux using straightforward commands.
Steps to Kill a Process in Linux
Step 1. Check Running Processes with top
Use the top command to view real-time system resource usage and identify processes consuming high CPU or memory:
# top
Look for the Process ID (PID) of the process using excessive resources.

Step 2. Kill the Process Using Its PID
Once you have the PID, use the kill command to terminate the process. For example, to kill a process with PID 84799:
# kill -9 84799
The -9 flag forcefully stops the process.

Step 3. Find Specific Processes Using ps and grep
If you need to search for a process by name (e.g., mysql), use the following command:
# ps aux | grep mysql
a – Show processes for all users
u – show the user who owns each process
x – include processes not attached to a terminal

This will list all matching processes along with their PIDs.
Step 4. Kill Multiple Instances of a Process
Once you retrieve the list of PIDs, you can use the kill command to stop all related processes:
# sudo kill -9 <PID1> <PID2> <PID3>
Replace <PID1>, etc., with actual process IDs.
Conclusion:
To stop unresponsive or high-resource processes in Linux, identify the process using top or ps, and terminate it using the kill command. This is a quick and effective method to maintain your system’s stability and performance.