Kill processes on a port, but only if they belong to the same project.
# Kills ANY process on port 3000 # Could be your database, another # project, or a production process kill-port 3000
# Only kills if the process belongs # to your current project # Safe to use without thinking twice snipe-port 3000
Uses lsof to find all processes listening on the given port.
Determines each process's working directory via lsof -d cwd (macOS) or /proc/PID/cwd (Linux).
Compares the process's cwd and git repo root (including worktrees) against your current project.
Sends SIGTERM (or SIGKILL with -9) only to processes that belong to your project.
snipe-port 3000 # kill process on port 3000 snipe-port 3000 8080 # multiple ports snipe-port -9 3000 # force kill (SIGKILL) snipe-port --udp 3000 # target UDP
Uses only Node.js built-ins. No bloat, no supply chain risk.
Recognizes processes in git worktrees as part of the same project.
Use as a library in your Node.js scripts and tooling.
Uses execFileSync — arguments are never passed through a shell.