Learn how to target and terminate processes by name or pattern quickly and safely. 22.04.2026 | reading time: 3 min When a runaway daemon or a misbehaving script consumes resources, pkill lets the administrator kill matching processes by name or pattern from the shell quickly and reliably. Hands-on example: kill by command name Example session: find processes named "myapp", kill them, and verify removal using the following multiline session shown here with explicit command and output wrapped in triple backticks for clarity: ```bash\n$ ps aux | grep myapp\nmyuser 2345 5.1 1.2 123456 7890 ? Ssl 10:00 0:30 /usr/bin/myapp --serve\nmyuser 2356 0.0 0.1 23456 1234 ? S 10:01 0:00 /usr/bin/myapp --worker\n$ sudo pkill -f myapp\n$ ps aux | grep myapp\n(my user sees no running myapp processes)\n``` Match methods and common flags pkill supports regular-expression matching by default and useful switches such as -f to match the full command line, -u to restrict by user, -P to match parent PID, -t to restrict by terminal, -n or -o to select newest or oldest match, and -SIG to send a different signal than SIGTERM; combine filters to avoid collateral damage and prefer a gentler signal first. Safety patterns to adopt Always preview matches with pgrep before killing, consider sending SIGINT or SIGTERM before SIGKILL, and use -u or exact-match flags to narrow scope; in scripts, check exit codes and log actions so the administrator can audit automated terminations. When pkill is not enough For system services prefer systemctl to stop or restart units, use cgroups or resource limits for containment, and resort to pkill only when a process must be targeted directly by name or pattern. Closing thought pkill is a compact and powerful tool that, when used with care and the right filters, makes process management fast and script-friendly; learn more and consider formalizing skills with exam prep at bitsandbytes.academy to move toward certifications such as CompTIA Linux+ or LPIC-1. Join Bits & Bytes Academy First class LINUX exam preparation. utilities processes scripting troubleshooting security