To kill a process by its PID (Process ID) in Linux, use the kill
command followed by the PID. First, identify the PID using ps
, top
, or pidof
. For example:
- Find the PID:
bash
ps aux | grep process_name
or
bashpidof process_name
- Kill the process:
bash
kill PID
- To force kill if it doesn’t stop:
bash
kill -9 PID
Ensure you have the necessary permissions to kill the process. Be cautious when terminating critical system processes to avoid system instability