Overview
kport is a small CLI tool and interactive TUI written in Rust. It solves a single everyday problem: EADDRINUSE: address already in use.
When an orphaned Next.js process, a background server, or a stuck container refuses to release port 3000 or 8080, kport queries the kernel socket tables, finds the PID, and clears the port immediately.
It is published on both Crates.io (kport) and NPM (@neuralshyam/kport), so you can run it without installing anything via bunx or npx.
Links
- NPM:
@neuralshyam/kport - Crates.io:
kport - Source Code:
github.com/neuralshyam/kport - Docs:
neuralshyam.github.io/kport
Quick Run
# Instant run with bunx
bunx @neuralshyam/kport 3000
# Instant run with npx
npx @neuralshyam/kport 3000
Installation
# Cargo
cargo install kport
# Bun
bun add -g @neuralshyam/kport
# NPM
npm install -g @neuralshyam/kport
Commands & Usage
- Kill specific ports or ranges:
kport 3000 kport 3000 8080 5000..5010 - Wildcard matching & environment tags:
kport "80*" :dev - Force kill (SIGKILL):
kport -f 3000 - Interactive TUI:
Opens a terminal UI listing all listening ports, memory usage, and process names. Select ports with arrow keys and press Space or K to kill.kport - Probe latency:
kport --probe 3000 - Clean zombie processes:
kport --zombies
How It Works
- Kernel Socket Tables: Instead of spawning sub-processes like
lsofornetstat,kportreads/proc/net/tcpon Linux, callssysctlon macOS, and usesGetExtendedTcpTableon Windows. - Zero Runtime Dependencies: The binary is standalone. The NPM wrapper downloads the platform-specific compiled binary during installation or runtime.
- No Overhead: Runs in under 2 milliseconds.