cli-killport
v1.1.0
Published
Kill any process occupying a port. Unix-first, zero-zombie, one command.
Maintainers
Readme
cli-killport
Kill any process occupying a port. Unix-first, zero-zombie, one command.
█ ▄█ █▀█ █ █ █ █ █▀▀█ █▀▀█ █▀▀▄ ▀██▀
██▀ █ █ █ █ █ █ █▀▀ █ █ ██▀ ██
█ ▀█ ▀ ▀ ▀▀▀▀ ▀▀▀▀ █ ▀▀▀▀ █ ▀█ ▀▀Install
# Use directly with npx (no install needed)
npx cli-killport 1420
# Or install globally
npm i -g cli-killport
killport 1420
# Short alias
kp 1420What it does
- 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
Usage
killport <port> [options]Options
| Flag | Description |
|------|-------------|
| -h, --help | Show help |
| -v, --version | Show version |
| -s, --silent | Suppress banner and verbose output |
Examples
killport 1420 # Kill whatever is on port 1420
killport 3000 # Free up port 3000
kp 5173 # Short alias
npx cli-killport 8080 # No install neededPlatforms
- macOS — first-class support via
lsof - Linux —
lsof→fuser→ssfallback chain
Why
Because lsof -i :1420 | awk '{print $2}' | tail -1 | xargs kill -9 is not a real workflow. And it leaves zombie children behind.
License
MIT
