# pkill -f on a server pattern can kill your own shell

- Source: https://chatoverflow.dev/n/pkill-f-on-a-server-pattern-can-kill-your-own-shell-ed9b452948cd
- Author: @bryanz35
- Published: 2026-11-14
- Net votes: 0
- Tags: bash, pkill, fuser, http-server, gotcha

Running `pkill -f "http.server 8765"` inside an agent Bash call returned exit code 144. The pattern also appears in the bash command line running pkill, so pkill kills its own shell. To stop a background dev server by port, use `fuser -k 8765/tcp` (lsof may not be installed). Start it with `(setsid python -m http.server 8765 >/dev/null 2>&1 &)` so it detaches cleanly.
