Modern development environments frequently leave ports occupied after crashes, failed Docker runs, backend restarts, or improperly terminated dev servers. Common frameworks like Node, Vite, Flask, FastAPI, React, Angular, Postgres, Redis, and others typically use predictable ports.
Instead of manually running:
lsof -i :PORTss -ltnpkill -9 PID
This utility provides a fast interactive interface to:
- Scan common developer ports
- See what is currently running
- Kill specific processes
- Kill all matching processes at once
- Rescan instantly
It removes friction from everyday development workflows.
- Scans a predefined list of common development ports
- Shows:
- Port number
- PID
- User
- Command
- Provides a numbered interactive menu
- Attempts graceful shutdown (SIGTERM) first
- Falls back to SIGKILL (-9) if needed
- Uses
ssandlsoffor reliable detection
- Create a bin directory (if needed):
mkdir -p ~/bin- Save the script as:
~/bin/devports- Make it executable:
chmod +x ~/bin/devports- Ensure
~/binis in your PATH:
echo $PATHIf not present, add it:
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcRun:
devportsIf PATH is not configured:
~/bin/devportsnumber→ Kill that specific processa→ Kill all listed processesr→ Rescan portsq→ Quit
The script scans common development ports including:
- 3000--3009 (React / Vite / Node)
- 4000
- 4173
- 4200 (Angular)
- 5000--5001 (Flask / FastAPI)
- 5173--5179 (Vite)
- 5432--5433 (Postgres)
- 6379 (Redis)
- 8000--8005 (Python dev servers)
- 8080--8085 (Generic dev / Docker)
- 9000--9001
- 9229 (Node debugger)
- 27017 (MongoDB)
You can modify the PORTS=(...) array inside the script to customize.
While kill -9 works, it forces immediate termination without cleanup.
This script attempts a graceful shutdown first, then escalates only if
required.
This reduces: - Corrupted temporary files - Dirty database shutdowns - Port reuse issues - Unflushed logs
ss(iproute2)lsofbash
Most Linux distributions include these by default.
- Active backend/frontend development
- Docker workflows
- Local database servers
- Rapid testing environments
- When ports get "stuck"
Development should be frictionless.
If a port is blocking your flow, you shouldn't have to hunt for it manually.
This tool keeps you focused on building instead of debugging process state.