Skip to main content

whatport

CI crates.io clispec

Find what process is listening on a TCP/UDP port, and free it. The fast, agent-friendly answer to "what's on :5099?" and "kill whatever it is."

Why

"Address already in use." Then the dance: lsof -i :5099, read the pid, kill, hope. whatport collapses that into one command with structured output: whatport 5099 tells you the owner; whatport kill 5099 frees it. JSON when piped, a table in a terminal.

Install

cargo install whatport

Quickstart

# What's on this port?
whatport 5099
# PORT   PROTO PID      PROCESS                USER       UPTIME    ADDRESS
# 5099   tcp   1234     node                   ruben      3h12m     127.0.0.1

# Just the data (JSON when piped)
whatport 5099 | jq '.listeners[0].pid'

# Free it (SIGTERM, or --force for SIGKILL)
whatport kill 5099
whatport kill 5099 --force

# Everything that's listening
whatport list
whatport list --proto udp

whatport <port> is shorthand for whatport inspect <port>.

Commands

command mutating what it does
whatport <port> / inspect <port> no the listener(s) on a port: pid, process, command, user, uptime, address
list no every listening TCP/UDP socket
kill <port> [--force] yes SIGTERM (or SIGKILL with --force) the owner(s); reports what it signalled
schema no the clispec v0.3 contract as JSON
completions <shell> no shell completion script

Global flags: -o/--output auto\|json\|text (auto = text on a TTY, JSON when piped) and --proto tcp\|udp\|all.

Output

  • Inspect/list: {"listeners":[{port, proto, addr, pid, process, command, user, uptime_secs}, …]}.
  • Kill: {"port", "signal", "killed":[{pid, process, ok, …}], "changed"}.

When the OS won't let you see the owner of a socket you don't own, the port and protocol are still shown and pid/process are omitted - run with sudo for full owner details rather than getting a silent gap.

Platforms

macOS and Linux. Pure Rust (netstat2 for the socket table, sysinfo for process details) - no shelling out to lsof/ss.

Exit codes

code meaning
0 success
1 nothing listening on the queried port
2 system error (socket/process table unreadable, or a kill failed)
3 usage error (bad arguments)

For agents (clispec)

whatport follows The CLI Spec: structured output on stdout, structured error envelopes on the last line of stderr, and a schema subcommand whose output validates against clispec.dev/schema/v0.3.json (checked by the test suite). Read-only commands are mutating: false; kill is the one mutating: true command.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whatport-0.1.1.tar.gz (38.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

whatport-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (589.0 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

whatport-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (553.6 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

whatport-0.1.1-py3-none-macosx_11_0_arm64.whl (471.3 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

whatport-0.1.1-py3-none-macosx_10_12_x86_64.whl (504.3 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file whatport-0.1.1.tar.gz.

File metadata

  • Download URL: whatport-0.1.1.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for whatport-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eaf7598a4842e8853a971c6456b3391faf6223ded6dbad3ed5a080cb61bbdc53
MD5 ade4848bd5fe393782573a554ce94f8c
BLAKE2b-256 4f54c5ddd1ccdf809e6aa2599b660df66099a25fbaa6a99dc4156831da9faa07

See more details on using hashes here.

File details

Details for the file whatport-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: whatport-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 589.0 kB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for whatport-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5661a00c2501726ac9cf3fb11f6488d3bc5e4d70963ca46dc2ddb58116bbf26
MD5 c1ee278c937e71da8b56f1ef29595ed2
BLAKE2b-256 a034c581a7b4187f7b3408433a01c4b78eeb139e1ba38f6c4ad62bbea7db321e

See more details on using hashes here.

File details

Details for the file whatport-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: whatport-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 553.6 kB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for whatport-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eddb211ad447b130fd1abd400847a69b8abaeebbb5a3c399bcea8cc7b8db6cb5
MD5 ca52175dd9523550f0d267f86c4fda49
BLAKE2b-256 a3d15059bf48f20f11476f6a55b3a5d890d2a83299f833ceff8e4c2a34a6276e

See more details on using hashes here.

File details

Details for the file whatport-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: whatport-0.1.1-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 471.3 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for whatport-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 088dff3796cffe3ee7576afc8a68e7b4d92da72cfe914044472f13083ad2a745
MD5 6a3b3a072af6a843b59741ad36d212e3
BLAKE2b-256 96b94a59a47c27e4a7c16dcfff4994aa92abe34900ce944396f942cd2031e420

See more details on using hashes here.

File details

Details for the file whatport-0.1.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: whatport-0.1.1-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 504.3 kB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for whatport-0.1.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9483747d8420b0a15224dcac0196a81da68a3b6c7acbfb8a16e4a5515cc271f3
MD5 7f634846a050fe4cd428e56d1ed8f7af
BLAKE2b-256 4b011067ec67c5afcfb1822ccf7eb5e3a912303108e1e3dde7abacde0724679e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

5 files

0.1.0

5 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page