# Killing Processes — Linux Command Line Fundamentals

Source: https://www.skillbyai.com/en/linux/linux-killing-processes

> Stop processes with kill, killall and pkill, and know when kill -9 is a last resort.

## kill by PID

`kill PID` sends a termination signal, asking the process to shut down gracefully.

```bash
ps aux | grep nginx
kill 842
```

## kill -9 — force it

`kill -9 PID` (SIGKILL) forcibly terminates a stuck process with no cleanup — use it only when a plain `kill` doesn't work.

```bash
kill -9 842
```

## killall & pkill

`killall nginx` kills every process named `nginx`. `pkill -f pattern` matches against the full command line.
