To kill a process in Linux, follow these steps:
-
Find the Process ID (PID):
Use thepscommand to list running processes and find the PID of the process you want to kill. For example, if you are looking for a process namedmy_process, you can run:ps aux | grep my_process -
Kill the Process:
Once you have the PID, use thekillcommand to terminate the process. Replace<PID>with the actual process ID you found:kill <PID> -
Force Kill (if necessary):
If the process does not terminate with the standardkillcommand, you can use the-9option to forcefully kill it:kill -9 <PID> -
Verify the Process is Terminated:
You can check if the process is still running by using thepscommand again:ps aux | grep my_process
This should effectively terminate the process you want to stop.
