| Crates.io | portdetective |
| lib.rs | portdetective |
| version | 0.1.0 |
| created_at | 2025-12-27 17:03:39.172684+00 |
| updated_at | 2025-12-27 17:03:39.172684+00 |
| description | Tiny CLI to see what's running on a given TCP/UDP port |
| homepage | |
| repository | https://github.com/makafui/portdetective |
| max_upload_size | |
| id | 2007503 |
| size | 78,068 |
What's running on this port, and how do I safely kill it?
Port Detective is a tiny, fast Rust CLI that replaces the lsof/netstat/ps incantation soup with one clear command.
Download the latest release for your platform from the releases page:
# Linux (glibc)
curl -L https://github.com/cmakafui/portdetective/releases/latest/download/portdetective-linux-x86_64.tar.gz | tar xz
sudo mv portdetective /usr/local/bin/
# Linux (musl - static binary, no dependencies)
curl -L https://github.com/cmakafui/portdetective/releases/latest/download/portdetective-linux-x86_64-musl.tar.gz | tar xz
sudo mv portdetective /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/cmakafui/portdetective/releases/latest/download/portdetective-macos-x86_64.tar.gz | tar xz
sudo mv portdetective /usr/local/bin/
# macOS (Apple Silicon)
curl -L https://github.com/cmakafui/portdetective/releases/latest/download/portdetective-macos-aarch64.tar.gz | tar xz
sudo mv portdetective /usr/local/bin/
cargo install --path .
portdetective 3000
🔎 Port 3000 (tcp) is in use
Process: node
PID: 42193
User: makafui
Command: node server.js --port=3000
CWD: /Users/makafui/projects/my-app
Parent: zsh (PID 41200)
Started: 2025-11-18 14:32:10
Suggested kill:
kill 42193
# or force if needed:
kill -9 42193
portdetective 55555
✅ Port 55555 is free (no listening process found)
portdetective list
PORT PROTO PID PROCESS USER COMMAND
3000 tcp 42193 node makafui node server.js --port=3000
5432 tcp 550 postgres postgres /usr/local/bin/postgres -D ...
8000 tcp 43011 python makafui uvicorn main:app --port 8000
📊 3 listening port(s) found
portdetective kill 3000
Interactive confirmation:
🔎 Port 3000 (tcp) is in use by:
node (PID 42193)
Command: node server.js --port=3000
CWD: /Users/makafui/projects/my-app
Are you sure you want to kill PID 42193? [y/N]:
| Command | Aliases | Description |
|---|---|---|
portdetective <PORT> |
— | Inspect a port (shorthand) |
portdetective inspect <PORT> |
i |
Inspect what's on a port |
portdetective list |
l, ls |
List all listening ports |
portdetective kill <PORT> |
k |
Kill process on a port |
| Flag | Short | Description |
|---|---|---|
--json |
-j |
Output as JSON |
--tcp |
— | Only show TCP connections |
--udp |
— | Only show UDP connections |
--force |
-f |
Send SIGKILL instead of SIGTERM (kill) |
--no-prompt |
-y |
Skip confirmation prompt (kill) |
portdetective 3000 --json
{
"port": 3000,
"protocol": "tcp",
"status": "in_use",
"processes": [
{
"pid": 42193,
"name": "node",
"user": "makafui",
"command": ["node", "server.js", "--port=3000"],
"cwd": "/Users/makafui/projects/my-app",
"parent_pid": 41200,
"parent_name": "zsh",
"started": "2025-11-18T14:32:10+02:00",
"protocol": "tcp"
}
]
}
MIT