kill vs kill -9: Graceful and Forced Termination

Terminate a specific process by PID: first with a plain kill (SIGTERM), then with kill -9 (SIGKILL) only if it refuses to exit.

LinuxprocesscommandTerminalMedium risk
Run kill 12345 to ask PID 12345 to exit cleanly; if it is still alive after a few seconds, run kill -9 12345 to force it down.

01Command

Command
$ kill 12345

02What it does

kill 12345 sends SIGTERM, a polite request the program can handle by saving state and shutting down cleanly. kill -9 12345 sends SIGKILL instead, which the kernel uses to remove the process immediately — the program gets no chance to run cleanup code. Always try the plain form first and treat -9 as the last resort, because SIGKILL can leave lock files, temp files, or corrupted state behind.

03Risk

RiskMedium risk
!Warning: Never kill -9 system daemons or anything writing to disk (databases, editors with open files) unless a plain kill has already failed — the skipped cleanup can cause data loss.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • kill - send a signal to a process
    man7.org · technical · 2026-09-17
    Evidence: kill sends signals to processes; the signal list includes "9) SIGKILL" and "1) SIGHUP", and the default signal is TERM. The -s/-<signal> options select the signal to send.
  • Ubuntu Manpage: kill - terminate or signal processes
    manpages.ubuntu.com · technical · 2026-09-17
    Evidence: The kill utility sends a signal to processes by PID; the -<signal> form selects the signal, e.g. -9 (SIGKILL) and -HUP (SIGHUP); the default is SIGTERM.

Last verified: 2026-09-19 · Category: System & Settings

06Related solutions