Updated: 3 November 2026 · Applies to: Linux, procps and util-linux
To terminate a process in Linux, send it a signal with kill, pkill, or killall, depending on whether you have the process ID, the process name, or want to stop every instance of a program at once. kill works by process ID (PID); pkill and killall work by process name.
Find the process ID first
List every running process and its PID:
ps -A
To find just the PID of a specific program, for example MySQL:
pidof mysqld
Or search the full process list for it:
ps aux | grep mysqld
Or, using the dedicated search tool:
pgrep mysqld
Kill a process by PID
kill PID
To kill more than one process in the same command:
kill PID1 PID2 PID3
Which signal kill actually sends
Plain kill sends SIGTERM (signal 15) by default, a polite request asking the process to shut itself down, which it can catch and respond to, for example by saving its state first. Three signals come up most often:
- SIGTERM (15): ask the process to exit cleanly. This is the default and the one to try first.
- SIGHUP (1): originally meant the controlling terminal hung up; many daemons now treat it as "reload your configuration" rather than "exit."
- SIGKILL (9): forces the kernel to terminate the process immediately. It cannot be caught, ignored, or handled, so the process gets no chance to clean up or save anything.
Reach for SIGKILL only once SIGTERM has failed to stop the process, since it is the one that can leave data unsaved or a lock file behind:
kill -9 PID
The same thing, written with the signal's name instead of its number:
kill -SIGTERM PID
Kill a process by name instead of PID
pkill matches by process name directly, so you do not need to look up the PID first:
pkill mysqld
killall does the same, but is specifically built to stop every instance of a program, main process and every child process it spawned, in one go:
killall mysqld
Check whether it actually stopped
pgrep mysqld
No output means nothing matching that name is still running. For a service managed by systemd, check its real status instead:
systemctl status mysql
A few things worth knowing before you kill anything
- A normal user can only kill their own processes, not another user's.
- Root can kill any process on the system, including other users' and the system's own.
- PID 1, the init system (systemd on most current distributions), ignores a plain
killand cannot be terminated this way, specifically so the whole system cannot be shut down by accident.