# pgrep and pkill

*noun*

say it: **“pee-grep and pee-kill”** **/ˈpiɡrɛp ənd ˈpikɪl/**

Two commands that find running programs by name: pgrep lists them and pkill sends them a signal, usually to stop.

## What do **pgrep and pkill** do?

`pgrep` finds running programs by name and prints their PIDs; `-a` adds each one's command line. `pkill` sends the same matches a signal, TERM unless you name another. `-f` matches the whole command line, which a script needs, since its name comes after `bash`. Run `pgrep` first, so you see what `pkill` would stop.

```bash
pgrep -af alarm    # 2781 bash ./alarm.sh
pkill -f alarm     # asks every match to stop
pgrep -af alarm    # nothing: it's gone
```

## In a sentence

- “With **pgrep and pkill**, Sam stopped the alarm by name without looking up its number.”
- “Check with pgrep first; **pgrep and pkill** match the same names.”

Level: Journeyman · [More Unix terms at this level](https://www.ask-codey.com/glossary?category=unix&level=3)

Updated: November 10, 2026

Source: https://www.ask-codey.com/glossary/pgrep-and-pkill
