Port 3000 already in use? EADDRINUSE? PortStat is a small Windows system-tray app that shows every local dev server listening on a TCP port and lets you open, restart or stop it in one click. No more netstat -ano | findstr :3000 and taskkill /PID … /F.
⬇ Download PortStat.exe — portable, no installer, Windows 10/11.
Website: https://preraksh10.github.io/PortStat/
- Tray icon with a live badge showing how many dev ports are active (3000, 5173, 8000, 8080, … plus any you pin)
- One list of listening ports with process, PID, command, project folder, memory and uptime. Filter by port, process or folder
- Kill stops the server and the watcher that would respawn it (
nodemon,uvicorn --reload, Flask/Django reloaders, venv launchers) - Docker and WSL aware: ports published by Docker are stopped with
docker stop <container>; Docker Desktop and WSL networking are never killed - Restart relaunches a server with its original command, folder and environment in a new console window, then confirms the port comes back
- Stop All Dev Servers lists what it will stop and asks first; database ports (PostgreSQL, MySQL, Redis, MongoDB) are skipped
- Pin/watch custom ports, find and copy a free port, open
http://localhost:<port>, open the project folder - Global hotkey Ctrl+Alt+P; optional launch on Windows login (Startup-folder shortcut, no registry edits)
- Safe by design: critical Windows processes (
lsass.exe,services.exe,svchost.exe, …) and PortStat itself are never terminated, even as Administrator - Command line:
PortStat.exe --list,PortStat.exe --kill 3000
- Download
PortStat.exe(always the latest release). - Put it in any folder you like (settings are saved next to it) and run it.
Windows SmartScreen: the exe isn't code-signed yet, so Windows may show "Windows protected your PC". Click More info → Run anyway. You can check the download against SHA256SUMS.txt from the same release:
(Get-FileHash .\PortStat.exe -Algorithm SHA256).HashScoop:
scoop bucket add preraksh10 https://github.com/preraksh10/scoop-bucket
scoop install preraksh10/portstatwinget: winget install preraksh10.PortStat (pending review).
Requires Python 3.12+.
git clone https://github.com/preraksh10/PortStat.git
cd PortStat
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt
.venv\Scripts\pythonw.exe portstat.py # tray app, no console windowClick the tray icon or press Ctrl+Alt+P to show the window. Launching PortStat again while it's running brings the existing window to the front.
| Key | Action |
|---|---|
| Ctrl+Alt+P | Show / hide the window (global) |
| Ctrl+F | Focus the filter box |
| Up / Down | Move selection |
| Enter | Open the selected port in the browser |
| Delete | Stop the selected server (asks first) |
| F5 | Rescan |
| Esc | Hide to tray |
Click a port number to copy its URL, the PID line to copy the PID, and the folder to open it in File Explorer.
PortStat.exe --list # list all listening TCP ports
PortStat.exe --kill 3000 # stop whatever serves :3000 (exit code 1 if it couldn't)
PortStat.exe --versionRun from source with python portstat.py --list.
Settings are stored in config.json next to PortStat.exe (or the project folder when run from source), created on first run:
| Key | Default | Meaning |
|---|---|---|
pinned_ports |
[] |
Extra ports treated as dev ports and listed first |
ignored_executables |
Windows services | Hidden in "All" view when hide_system_noise is on |
hide_system_noise |
true |
Hide background Windows services |
dev_ports_only |
true |
Show only dev/pinned ports |
poll_interval_sec |
3.0 |
Tray badge refresh interval (1–300) |
window_width / window_height |
660 / 540 |
Window size in logical (DPI-independent) pixels |
If config.json isn't valid JSON, PortStat starts with defaults and keeps a copy as config.corrupt.json. A single invalid setting only resets that setting.
PortStat writes a small rotating log, portstat.log (up to 512 KB plus 2 older copies), next to config.json. It records stops, restarts, configuration problems and unexpected errors.
| PortStat | netstat + taskkill |
TCPView | npx kill-port |
|
|---|---|---|---|---|
| Tray icon + hotkey | ✅ | — | — | — |
| Stops reloaders that respawn the server | ✅ | — | — | — |
| Docker container aware | ✅ | — | — | — |
| Restart with original command | ✅ | — | — | — |
| No Node.js required | ✅ | ✅ | ✅ | — |
.venv\Scripts\pip install -r requirements-dev.txt
.venv\Scripts\python.exe -m unittest discover -s tests -t . -v
.venv\Scripts\python.exe scripts\build.py # build\PortStat.exe + SHA256SUMS.txt
.venv\Scripts\python.exe scripts\generate_ico.py # regenerate assets\icon.icoThe build uses Nuitka (single-file exe). If Visual Studio Build Tools aren't installed, Nuitka downloads a MinGW compiler on first use. The exe is built with --windows-console-mode=attach, so --list prints in a terminal while the tray app opens no console window. Output may appear after the prompt returns.
mainis protected and only receives pull requests fromdevelop.- Branch from
develop, open your pull request againstdevelop, and make sure thetestcheck passes. - Releases are tagged from
main(vX.Y.Z); GitHub Actions buildsPortStat.exeandSHA256SUMS.txtand publishes the release.
portstat.py launcher (also the build entry point)
src/
main.py CLI, single-instance guard, hotkey, wiring
config.py settings, logging, shared constants, data classes
scanner.py listening-port scan, Docker port mapping, filtering
killer.py safe stop/restart, supervisor detection, Docker stop, autostart
tray.py tray icon, badge rendering, background poller
ui_popup.py CustomTkinter window
tests/ unit tests (python -m unittest)
scripts/ build script, icon generator
website/ GitHub Pages site (deployed by .github/workflows/pages.yml)
assets/ app icon, README screenshots
packaging/ winget and Scoop manifests
