portkill-cli
v1.7.7
Published
Cross-platform CLI tool to find and kill processes by port number
Downloads
103
Readme
portkill
Simple CLI tool to find and kill processes running on specific ports. Works on Linux, macOS, and Windows.
Why?
Ever tried to start your dev server and got hit with EADDRINUSE? Yeah, me too. This is a tiny tool that makes it easy to find what's using a port and kill it.
Install
Install globally with npm:
npm install -g portkill-cliThis installs it globally so you can run portkill from anywhere.
Or use without installing:
npx portkill-cli kill 3000Requirements:
- Node.js 14 or higher
- Linux:
ssornetstat - macOS:
lsof - Windows:
netstatandwmic
Most systems already have these installed.
Usage
# Kill whatever's running on port 8080
portkill kill 8080
# Kill on multiple ports at once
portkill kill 3000,3001,8080
# Find processes by name (uses regex)
portkill find node
# List all processes listening on ports
portkill list
# List processes on specific ports
portkill list 3000,8080
# Skip the "are you sure?" prompt
portkill kill 8080 --yes
# Force kill (SIGKILL on Unix, /F on Windows)
portkill kill 8080 --force
# See more details about processes
portkill list --verbose
# Get JSON output (great for scripting)
portkill list --jsonOptions
| Flag | Description |
|------|-------------|
| -i, --interactive | Interactive mode: select ports with arrow keys |
| -f, --force | Force kill (SIGKILL / /F) |
| -y, --yes | Skip confirmation prompt |
| -v, --verbose | Show full process info (PID, USER, CMD) |
| --json | Output as JSON |
Examples
# Quick kill
portkill kill 3000 --yes
# See what's running before killing
portkill list 8080 --verbose
# Kill a stuck process
portkill kill 3000 --force
# Find all node processes
portkill find nodeHow It Works
- Linux: Uses
ss(modern) ornetstat(fallback) to find processes - macOS: Uses
lsofto find processes - Windows: Uses
netstat+wmicto get process details
License
MIT
