Free a TCP port in one command.
开发时端口被占了?别再手翻 lsof / kill —— 一行搞定。
portfree 3000curl -fsSL https://raw.githubusercontent.com/YOUR_USER/portfree/main/portfree.py -o ~/.local/bin/portfree
chmod +x ~/.local/bin/portfreeOr just clone and run:
python3 portfree.py 3000Needs
lsof(comes with macOS / most Linux distros).
# free port 8080 (SIGTERM)
portfree 8080
# force kill (SIGKILL)
portfree 8080 -f
# only list who holds the port
portfree 8080 -n$ portfree 5173
port 5173 held by:
• pid 48201 node
sent SIGTERM → pid 48201 (node)
port 5173 is free ✓
- zero dependencies (stdlib only)
- one file, ~100 lines
- safe defaults (
SIGTERM, dry-run flag)
MIT