System and processes

The kill command

Sends a signal to a process. By default it sends SIGTERM, which asks the process to finish and lets it close its files. With -9 (SIGKILL) it kills the process without letting it clean up, so it is the last resort.

Syntax

kill [-señal] PID...Try it in the terminal →

Most useful options

-lLists the names and numbers of the available signals
-s <señal>Chooses the signal by name, for example -s TERM
-15SIGTERM: asks the process to finish. It is the default signal
-9SIGKILL: ends the process at once. It cannot be caught or ignored
-1SIGHUP: many daemons use it to reload their configuration
-2SIGINT: the same as pressing Ctrl+C in the process

Copy-ready examples

$ kill 2231asks process 2231 to finish (SIGTERM).
$ kill -9 2231kills process 2231 without giving it a chance to save anything. Use it only if the default signal does not work.
$ kill -lshows the list of available signals.

Example output

 1) SIGHUP	 2) SIGINT	 3) SIGQUIT	 4) SIGILL	 5) SIGTRAP
 6) SIGABRT	 7) SIGBUS	 8) SIGFPE	 9) SIGKILL	10) SIGUSR1
$ kill -HUP 1184sends SIGHUP to process 1184. A service that rereads its configuration on receiving it, such as the nginx master process, will do so.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
bash: kill: (99999) - No such processNo process has that PID. It may have already finished.Find the right PID with ps or pgrep before killing anything.
bash: kill: (1) - Operation not permittedThe process belongs to another user or to root, and you do not have permission to signal it.Check the owner with ps -o user,pid,cmd -p 1. Only root can kill other users' processes; use sudo carefully.
bash: kill: firefox: arguments must be process or job IDsYou passed a name instead of a PID.To kill by name use pkill firefox or killall firefox.

Typical mistakes

  • By default it sends SIGTERM (15): it asks to finish, it does not force. Save your work before using -9.
  • A PID is not a job number: for a job use %N (kill %1).
  • You cannot kill process 1 (init/systemd) or your own shell.

Differences from similar commands

  • pkill: kills processes by name or pattern, without looking up the PID first.
  • killall: kills all processes with an exact name. It is useful, but riskier when several match.
  • top: can also kill processes, with the k key, interactively. It asks for the PID and the signal before sending it.

Security

Killing the wrong process can take down a service. Check the PID with ps -o user,pid,cmd -p PID before sending signals, and do not use -9 out of habit: SIGKILL gives no chance to close files or save state.

Related commands

FAQ

Why does my process not end with kill?

It may be ignoring SIGTERM or taking time to clean up. Wait a few seconds and, if it still runs, try -9. A process in state D (waiting for disk) does not die until its I/O finishes.

What is the difference between kill and pkill?

kill needs the PID. pkill searches by name or pattern and sends the signal in one step.

Can I send a signal to a process that is not mine?

Only if you are root or have rights over it. Otherwise the system answers Operation not permitted.

More System and processes commands

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course