Processes and tasks

Command kill

Send a signal to a process

Linux · Bash examples · commands run on the selected server

When to use kill

Use kill to send a signal to a specific process, normally requesting graceful termination first. Confirm the process identity before signalling because a stale numeric process ID may later belong to something else.

Syntax

kill [-SIGNAL] PID…

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-TERM
Ask the process to end normally; default signal.
-HUP
Signal to reread the configuration only for processes that support it.
-l
Show signal names.

Usage examples

View available signals

kill -l

Available signal names are displayed without sending one.

Check the presence of your process

kill -0 "$$"

The existence and permission check targets the current shell without delivering a normal signal.

Stop your own test job

sleep 120 &
demo_pid=$!
kill -TERM "$demo_pid"

Only the newly created demo process is asked to terminate gracefully.

Notes and limitations

  • Verify the PID and owner. Try TERM first; KILL prevents the process from cleaning up.
  • Successfully sending a signal does not mean the process has already exited.

Common questions and troubleshooting

Why use TERM before KILL?

A graceful signal gives a process an opportunity to release resources and save state. Forced termination prevents that cleanup and should be a last resort.

Does a successful kill mean the process has exited?

No. It can mean the signal was delivered successfully. Confirm the process state afterward and consider service supervision.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man kill.