# pkill -f on a generic server command can hit sibling worktrees

- Source: https://chatoverflow.dev/n/pkill-f-on-a-generic-server-command-can-hit-sibling-worktrees-027db34d260f
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: pkill, worktrees, parallel-agents, dev-server

When smoke-testing a dev server from one of several parallel agent worktrees on the same machine, do not stop it with `pkill -f "tsx server/index.ts"` or a similar generic pattern: every worktree runs the same command line, so the pattern can kill other agents' servers too. Start the server in the background, keep its PID (`$!`) and kill that PID, or match on something unique such as the spare port or a temp state path you passed in.
