CloudsArk
Commands Linux

What Is the kill Command in Linux?

Learn what the kill command does in Linux, how its syntax works, and when to use it.

What Is the kill Command in Linux?

Introduction

The kill command sends signals to processes by PID. It is useful for beginners, Linux administrators, DevOps engineers, and RHCSA students because it solves practical terminal tasks.

What the Command Does

Use kill to work with the specific Linux object it manages. Before changing anything, identify the target and run a read-only check when possible.

Basic Syntax

kill SIGNAL PID

The syntax includes the command, any options, and the target object.

Common Options

  • -TERM: request graceful termination.
  • -KILL: force immediate termination.
  • -HUP: commonly reload or hang up a process.

Practical Examples

kill 1234
kill -TERM 1234
kill -HUP 1234
kill -9 1234

Verification command:

ps -p 1234

Example output:

PID TTY          TIME CMD

When to Use This Command

Use kill when you know the PID and need to send a signal. Start with SIGTERM before using SIGKILL unless the situation is urgent.

Common Mistakes

  • Using kill -9 first and preventing cleanup.
  • Killing a stale or wrong PID.
  • Assuming all signals mean terminate; some services treat HUP as reload.

Quick Reference

kill 1234
kill -TERM 1234
ps -p 1234

Summary

The kill command is safest when you understand the target, choose the right option, and verify the result with a separate command.