Port Kill: Supports macOS, Linux, and Windows operating systems, offering a simple command-line interface (CLI), status bar, and optional dashboard.
“Ports are occupied” is a pain that every developer has encountered.
Is there a way to clean it up immediately without memorizing those complicated command lines, just enter a number?
——This isport-kill.
A common nightmare for developers
When starting a project locally, you may see an error like this:
Error: Port 3000 is already in use
The traditional practice is:
lsof -i :3000 # 查找进程
kill -9 <PID> # 杀掉进程
Windows users also have to type longer commands:
netstat -ano | findstr :3000
taskkill /PID <PID> /F
Repetition and trouble.
So,port-kill it appeared.
What is port-kill?
port-kill is an open-source tool developed by KageHQ ,
Its role is very simple:
🪄 “Enter the port number and kill all processes occupying the port with one click.”
Whether you’re using macOS, Linux, or Windows, you can use it directly.
Get started quickly
You don’t even have to install it!
Temporary use (recommended)
npx port-kill 3000
Global installation
npm install -g port-kill
port-kill 8080
It’s that simple, release the port in one second.
How is it done?
port-kill Commands are automatically executed depending on the system:
| system | Look for port commands | End process command | |
|---|---|---|---|
| macOS/Linux | lsof -i :3000 | kill -9 <PID> | |
| Windows | `netstat -ano | findstr :3000` | taskkill /PID <PID> /F |
The entire process is automated and does not require users to remember any commands.
Schematic diagram
输入端口号 → 检查系统类型 → 找到PID → 执行kill命令 → 释放端口
The script core is index.js in , with only a few dozen lines of code, but it encapsulates cross-platform logical judgment.
Usage scenarios
| Scene | Description |
|---|---|
| Error “Port in use” during local development | One-click solution |
| Docker is not completely shut down | Quickly clean up residual ports |
| Node/React/Vite debugging crashes | Restart the project environment immediately |
Summary of advantages
- Cross-platform support (Windows/macOS/Linux)
- Zero configuration, use and go
- Quickly clean up the dev port
- It is friendly to front-end, back-end, and full-stack development
Project structure at a glance
port-kill/
├── bin/port-kill.js # CLI 入口
├── index.js # 主逻辑
├── package.json # npm 配置
└── README.md # 文档
Project address
Epilogue
Sometimes the most practical tools are often the simplest.port-kill It may be just a few lines of code, but it saves countless hours in daily development.
The next time you see the “port occupied” error,
Don’t panic, just knock a sentence:
npx port-kill 3000
GitHub:https://github.com/kagehq/port-kill
Tubing: