How to Kill a Process on Linux using Command?

There might be an issue with applications that can get stuck and not work correctly. In this case, we can check the processes of those using high resources.

  1. First, let us run the top command to check which process utilizes high CPU usage. 

  2. Find the process ID from PID for the process that uses a high amount of CPU.

  3. Now, you get the process ID.
    Run the below-given command to kill that process.

kill – Kill a process by ID

4. If a Chrome user has the PID of 11053, then we will need to run the below-given command – 

Kill -9 11053

5. If you want to find the same process from all the users along with the ones that are not listed in the terminal, then you can run the below-given command –  

ps aux | grep mysql

  • a = show processes for all users
  • u = display the process’s user/owner
  • x = also shows processes not attached to a terminal

Using the ps aux | grep mysql command, you will get all the PIDs for the same process. You can run the kill command and all the PIDs that will kill the process for the same service.


Was this answer helpful?

« Back