OS/Linux

[kill process] How to find the Process ID and Kill it

See_the_forest 2022. 10. 31. 10:20

Step 1 : Find the Process ID(PID) of the program

There are several ways we can use for finding the PID of a process.

 

# If we know the name of the process 
pidof <program_name> 

# Returns all the running process on the system
ps aux | grep -i "name of our desired program"

 

ps aux command returns all the running process on the system. And the grep afterwards shows the line which matches with the program name.

 

ps aux | grep -i rstudio

 

 

Step 2 : Kill the process using the PID

Once we have the PID of the desired application, we can command to kill the process : 

 

# Command to kill the rstudio process 
sudo kill -9 22390

 

 

 

Source from : https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/