kill any process occupying a port. unix-first, zero-zombie, one command.
npx cli-killport 3000- finds every process bound to the given port (
lsof,fuser,ss) - shows you what it found — pid, name, user, command, state, children
- kills the entire process tree bottom-up (children first, parent last)
- sends
SIGTERM→ brief grace →SIGKILL(-9) → kills process group - reaps zombie children by signaling parent processes
- verifies the port is actually free before exiting
# use directly with npx (no install needed)
npx cli-killport 1420
# or install globally
npm i -g cli-killport
killport 1420
# short alias
kp 1420killport <port> [options]| flag | description |
|---|---|
-h, --help |
show help |
-v, --version |
show version |
-s, --silent |
suppress banner and verbose output |
killport 1420 # kill whatever is on port 1420
killport 3000 # free up port 3000
kp 5173 # short alias
npx cli-killport 8080 # no install needed- macOS — first-class support via
lsof - Linux —
lsof→fuser→ssfallback chain
because lsof -i :1420 | awk '{print $2}' | tail -1 | xargs kill -9 is not a real workflow. and it leaves zombie children behind.
MIT