Home·Terminal commands

kill

Processes and system

Usage

kill [-SIGNAL] <pid>

Sends a signal to a PID to shut a process down; the default TERM lets it clean up, while `-9` cannot be caught, so open files and lock files are left behind.

Common flags

FlagMeaning
-15 / -TERMThe default: ask the process to shut down so it can clean up.
-9 / -KILLCannot be caught or ignored. The process dies immediately with no cleanup.
-1 / -HUPTraditionally means "reload your configuration" for daemons.
-0Send nothing; just test whether the PID exists and you may signal it.
-lList the signal names and numbers on this system.

Examples

kill 1234

Politely ask PID 1234 to exit.

kill -9 1234

Force it out after the polite attempt did nothing.

kill -HUP $(pgrep -o nginx)

Tell the nginx master process to reload its config.

What is running and what is eating the machine. Identifying it comes before killing it.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does kill do?

Sends a signal to a PID to shut a process down; the default TERM lets it clean up, while `-9` cannot be caught, so open files and lock files are left behind.

Q. How do I type it?

kill [-SIGNAL] <pid> — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

5 are listed here; the full set is in man kill. This command sits under Processes and system.

Related commands

man page: man kill