Senior
How to stop a running process in Linux?
sobes.tech AI
Answer from AI
There are several ways to stop a running process in Linux:
- Find the PID (process ID) using the command:
ps aux | grep process_name
- Use the
killcommand to send a termination signal:
kill PID
By default, the SIGTERM (15) signal is sent, which properly terminates the process.
- If the process does not terminate, you can send the SIGKILL (9) signal:
kill -9 PID
- For convenience, you can use
pkillby process name:
pkill process_name
- Also,
killallterminates all processes with the specified name:
killall process_name
It is important to use SIGKILL only if other signals do not work, as it does not give the process a chance to properly release resources.