How to Kill a Process in Linux

Find a process, send it SIGTERM first, and use SIGKILL only when necessary.

The safest process termination workflow is identify, inspect, then signal. SIGTERM is the normal first choice because it allows an application to clean up.

Step by step

1 Find the process

$ ps aux | grep node

Use a distinctive process name and verify the PID before acting.

2 Inspect the PID

$ ps -fp 12345

Confirm the PID and full command line.

3 Ask it to exit cleanly

$ kill 12345

SIGTERM asks the process to shut down gracefully.

4 Force termination as a last resort

$ kill -9 12345

SIGKILL cannot be caught or handled by the process, so normal cleanup is skipped.

Tips worth knowing

Frequently asked questions

What does kill do in Linux?

It sends a signal to a process identified by PID; the default is SIGTERM.

What does kill -9 do?

It sends SIGKILL, which the target cannot catch or ignore.

The commands behind it

kill

Terminate processes politely or forcibly — and understand what -9 really does.

ps

See what is running, find a process ID, and combine with grep to hunt down a program.

top & htop

The live dashboard: CPU, memory, load average and the processes consuming them.

Concepts involved: Process · PID (Process ID)

More how-to guides

Check disk space in Linux

See how much space is left, and find out what is using it.

Extract a .tar.gz archive

Unpack tar.gz, tar.bz2, tar.xz and zip archives from the command line.

Free a port that is already in use

Find which process holds a port and stop it cleanly.

Find and replace text in files

Replace text in one file or across a whole project, safely.