Linux kill Command: Send a Signal to a Process ID

kill sends a signal to the specified process ID (PID) or shell job. Contrary to its name, its default action is not a forceful termination but a termination request via SIGTERM.

What is the kill command?

In Bash, kill is provided as a shell built-in command. How a process reacts to a received signal depends on the type of signal and the program's implementation. If termination is necessary, first try the normal termination procedure and SIGTERM.

Basic syntax

kill [-signal] PID...

Installed implementations and options may vary depending on the distribution. Use help kill to check the description on the current system.

Examples

Checking PID

First, verify that the process is still the intended task.

ps -p 1234 -o pid,user,stat,cmd

Requesting normal termination

Explicitly send the default SIGTERM.

kill -TERM 1234

List of Available Signals

Check the names of signals in the current shell implementation.

kill -l

Check the PID and send a signal

kill sends a signal to a PID, not a name. The 12345 below is an example number, so when actually executing, first check your test process PID with ps and replace it.

ps -p 12345 -o pid,stat,comm
kill -TERM 12345
ps -p 12345 -o pid,stat,comm

On the first query, the target will be displayed, and when kill is successful, there is usually no output. After a normal termination is complete, the last query will show only the header or indicate that there is no target. This is a sample flow, and the time it takes to fully terminate depends on the process.

SIGTERM is the default termination request allowing cleanup. SIGKILL skips cleanup, so use it as a last resort. PIDs can be reused, so blindly trusting an old number could result in sending a signal to a different process.

Main Options and Format

Options/Format Description
-TERM Request normal termination of a process.
-INT Send a signal corresponding to a terminal interrupt.
-HUP Send a hangup signal, which is interpreted differently depending on the program.
-KILL Force an immediate termination. Cleanup operations may be skipped.
-0 Check existence and permissions without sending an actual termination signal.

Precautions when using

Since PIDs can be reused, do not use a PID that was long recorded. Failure of kill -0 may be due to absence of the process as well as lack of permissions. kill -KILL is a last resort and may interrupt data cleanup or file writing.

Frequently Asked Questions

What if you run kill but the process remains?

It may be ignoring SIGTERM or in the process of shutdown cleanup. Check the status and logs and review the proper service shutdown method first.

Official Documentation

You can check the exact behavior of options and implementation differences in the official kill documentation.

More in This Category
Linux stat Command: Display Detailed File Metadata

Linux stat Command: Display Detailed File Metadata

Learn how to use the Linux stat command to inspect file size, permissions, ownership, timestamps, inode, and filesystem metadata, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux pkill Command: Signal Processes by Name

Linux pkill Command: Signal Processes by Name

Learn how to signal Processes by Name with the Linux pkill command, including practical examples, key options, and important precautions.

Linux Tutorial / Install and Update Packages with APT and DNF

Linux Tutorial / Install and Update Packages with APT and DNF

Compare APT on Debian or Ubuntu with DNF on Rocky Linux for searching, installing, updating, and removing packages, including repository and transaction checks.

Linux systemctl Command: Manage systemd Services

Linux systemctl Command: Manage systemd Services

Learn how to manage systemd Services with the Linux systemctl command, including practical examples, key options, and important precautions.

Linux tar Command: Create and Extract Archives

Linux tar Command: Create and Extract Archives

Learn how to create and Extract Archives with the Linux tar command, including practical examples, key options, and important precautions.

Linux rmdir Command: Remove Empty Directories

Linux rmdir Command: Remove Empty Directories

Learn how to remove empty directories with Linux rmdir, delete empty parent paths, diagnose failures, and understand when rm -r is different.

Linux blkid Command: Find Block-Device UUIDs and Filesystem Types

Linux blkid Command: Find Block-Device UUIDs and Filesystem Types

Learn how to find Block-Device UUIDs and Filesystem Types with the Linux blkid command, including practical examples, key options, and important precautions.

Linux rm Command: Remove Files and Directories Safely

Linux rm Command: Remove Files and Directories Safely

Learn how to remove files and directory trees with Linux rm, use interactive safeguards, limit recursive deletion, and avoid destructive path mistakes.

Linux Tutorial / Hard Links vs. Symbolic Links in Linux: Differences and Examples

Linux Tutorial / Hard Links vs. Symbolic Links in Linux: Differences and Examples

Compare hard and symbolic links through inode and path behavior, then create both kinds of link and observe what happens when the original name changes.

Linux clear Command: Clear the Terminal Display

Linux clear Command: Clear the Terminal Display

Learn how to use the Linux clear command to clear the visible terminal screen and understand scrollback behavior, with essential options, practical examples, output interpretation, and common troubleshooting tips.