@naouts/portkill
v1.0.0
Published
Kill the process running on a given port — works on Windows, Linux, and macOS
Downloads
31
Maintainers
Readme
portkill
Kill the process running on a given port — instantly, from any terminal.
Why
You're running a dev server, you close it wrong, and now port 3000 is stuck.
You paste into Google, copy-paste some lsof command, grep the PID, then kill it.
portkill does all of that in one command.
Usage
No install needed:
npx @naouts/portkill 3000Or install globally:
npm install -g @naouts/portkill
portkill 3000Output
→ Scanning port 3000...
Found: node (PID 18423)
✔ Killed node (PID 18423)Options
| Flag | Description |
|------|-------------|
| <port> | Port number to kill (1–65535) |
| -h, --help | Show help |
| -v, --version | Print version |
Platform support
| OS | Method used |
|----|-------------|
| Windows | netstat -ano + tasklist + taskkill /F |
| macOS | lsof -ti + ps + kill -9 |
| Linux | lsof -ti + ps + kill -9 |
Examples
# Kill whatever is on port 8080
npx @naouts/portkill 8080
# Kill a stuck Vite dev server
npx @naouts/portkill 5173
# Kill a Next.js server
npx @naouts/portkill 3000If multiple processes share the port, all of them are killed.
Install globally
npm install -g @naouts/portkillThen use anywhere:
portkill 3000Permissions
On Linux/macOS, killing processes owned by another user requires sudo:
sudo portkill 80On Windows, run your terminal as Administrator if you get an access denied error.
Requirements
- Node.js 14 or later
- No external dependencies — only Node.js built-ins
License
MIT © naouts
