LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

kill

sends a signal to a process, usually to stop it

TLDR

Terminate a program using the default SIGTERM signal
$ kill [process_id]
copy
List available signal names
$ kill -l
copy
Terminate a background job
$ kill %[job_id]
copy
Send SIGHUP signal (reload for many daemons)
$ kill -HUP [process_id]
copy
Send SIGINT signal (like Ctrl+C)
$ kill -INT [process_id]
copy
Force kill a program (SIGKILL)
$ kill -9 [process_id]
copy
Pause a program (SIGSTOP)
$ kill -STOP [process_id]
copy
Send signal to all processes with a group ID
$ kill -SIGUSR1 -[group_id]
copy

SYNOPSIS

kill [-signal] pid...kill -l

DESCRIPTION

kill sends a signal to a process, usually to stop it. All signals except SIGKILL and SIGSTOP can be intercepted by the process to perform a clean exit. By default, SIGTERM is sent.

PARAMETERS

-l, --list

List signal names, or convert signal number to name
-L, --table
List signal names and numbers in a table
-s signal
Specify signal to send
-signal
Specify signal by name or number (e.g., -9, -KILL, -SIGKILL)
-p, --pid
Print the process ID only; do not send a signal
-q, --queue value
Send the signal using sigqueue(3) with the accompanying integer value
pid
Process ID to signal. A PID of 0 signals all processes in the current process group. A PID of -1 signals all processes with PID > 1.
%job_id
Job ID from shell job control

COMMON SIGNALS

SIGTERM (15): Request termination (default)SIGKILL (9): Force immediate termination (cannot be caught)SIGHUP (1): Hang up; often used to reload configurationSIGINT (2): Interrupt (Ctrl+C)SIGSTOP (19): Pause process (cannot be caught)SIGCONT (18): Continue paused process

INSTALL

sudo apt install procps
copy
sudo dnf install uutils-coreutils
copy
sudo pacman -S uutils-coreutils
copy
sudo apk add uutils-coreutils
copy
sudo zypper install procps
copy
brew install procps
copy
nix profile install nixpkgs#procps
copy

CAVEATS

SIGKILL (-9) should be used as a last resort as it doesn't allow the process to clean up. Use SIGTERM first and give the process time to exit gracefully.

HISTORY

Part of standard Unix since early versions. The kill command has been available since Version 4 AT&T UNIX (1973).

SEE ALSO

killall(1), pkill(1), pgrep(1), ps(1), top(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid