Skip to main content

whoisport

crates.io CI License: MIT

Find out what is listening on a port, who started it, and stop it safely. Works on Linux, macOS and Windows. One small binary, no runtime dependencies.

whoisport demo

lsof -i :3000 gives you a PID and a wall of columns. whoisport gives you the command line, the directory it was started from, who owns it and how long it has been running, which is usually what you need to decide whether to kill it. And when you do kill it, whoisport makes sure it only stops the process you were looking at.

Quickstart

whoisport              # what is listening on this machine?
whoisport 3000         # what is on port 3000, and who started it?
whoisport 3000 --kill  # ask it to exit (add --force if it refuses)
$ whoisport 3000
port    3000
pid     373232
parent  373230
user    kaitlyn
cmd     node node_modules/.bin/vite --port 3000
cwd     /home/kaitlyn/site
uptime  4m 12s

$ whoisport 3000 --kill
...
pid 373232: exited after SIGTERM

$ whoisport
PORT   PID      USER       CMD
3000   373232   kaitlyn    node node_modules/.bin/vite --port 3000
5432   ?        ?          ?
8080   41120    kaitlyn    python3 -m http.server 8080
ports marked ? are owned by another user; run with sudo to see it

Install

Platform Command
Any, with Rust cargo binstall whoisport (prebuilt) or cargo install whoisport (builds from source)
Any, with Python pipx install whoisport or uvx whoisport
macOS, Linux brew install dpologdvinity/tap/whoisport
Windows scoop bucket add whoisport https://github.com/dpologdvinity/scoop-whoisport then scoop install whoisport
Debian, Ubuntu download the .deb from Releases, then sudo apt install ./whoisport_*.deb
Fedora, RHEL download the .rpm from Releases, then sudo dnf install ./whoisport-*.rpm

Or download a binary from the Releases page: Linux (static, x86_64 and aarch64), macOS (Apple silicon and Intel) and Windows (x86_64).

Supported systems: Linux (reads /proc, no other tools needed), macOS (uses the built-in lsof), Windows 10 and 11.

Usage

whoisport [PORTS]... [--kill [--force]] [--json] [--udp]
You type You get
whoisport A table of every listening port
whoisport 3000 8080 Details of what is on each port (repeated ports are shown once)
whoisport 3000 --kill The details, then the process is asked to exit and given 3 seconds
whoisport 3000 --kill --force Same, but forcibly ended if it does not exit
whoisport --json The same data as a JSON array, for scripts
whoisport --udp UDP sockets instead of TCP

--kill always needs explicit ports; it never means "kill everything". --json cannot be combined with --kill.

JSON output

--json prints an array with one object per listener. Every object has the same keys; what is unknown (for example the owner of a process you may not inspect) is null:

[
  {
    "port": 3000, "proto": "tcp", "pid": 373232, "ppid": 373230, "user": "kaitlyn",
    "cmd": "node node_modules/.bin/vite --port 3000", "cwd": "/home/kaitlyn/site",
    "uptime_secs": 252, "container": null, "image": null
  }
]

Exit codes

Code Meaning
0 Success: everything asked for was found (and killed, if asked)
1 A requested port has nothing listening, or nothing is listening at all
2 Invalid arguments
3 A kill failed, or a process holding the port was deliberately not killed (see below), so the port may still be in use

Reading ?

On Linux, a process owned by another user cannot be inspected without sudo, so its row shows ?. On macOS lsof only lists your own processes without sudo, so other users' listeners are missing. On Windows, details of system services need an elevated terminal.

Stopping processes safely

--kill is built so that it cannot take down more than you meant to:

  • The process you saw is the process that is signalled. Each target is identified by its pid and its start time. If it exits and the system hands its pid to something else, that something else is left alone.
  • Service managers and parents are never signalled. When several processes share a socket (a supervisor and its workers, or systemd socket activation), stopping the supervisor takes down far more than one port. systemd, launchd and svchost.exe, and any process that is a parent of another holder, are skipped. whoisport then says which one still holds the port and exits 3.
  • It asks first. Each target is asked to exit; it is forced only with --force.
Platform --kill asks by --force
Linux, macOS SIGTERM SIGKILL
Windows Ctrl+C in the process's console, and WM_CLOSE to its windows TerminateProcess

On Windows, Ctrl+C reaches every program attached to a console, so whoisport only sends it when the target's console holds nothing but the target, its child processes and a shell. Otherwise it says so and leaves the choice of --force to you.

Text from other processes (command lines, paths) is printed with control characters, bidirectional-text overrides and zero-width characters escaped, so a hostile process cannot rewrite your terminal or disguise what it is.

Docker

When a port is published by a container, whoisport shows the container name and image (docker web (nginx:alpine)), even though the docker-proxy process behind it is owned by root. Docker is consulted only when a listener looks like Docker's forwarder or its owner cannot be read, only for a local daemon (not an ssh:// or remote DOCKER_HOST), and each Docker call is cut off after 2 seconds, so a stuck daemon never hangs whoisport: the names are simply left out. --kill on such a port prints the matching docker stop <name> command, because killing the forwarder only breaks the port mapping.

UDP

UDP has no listening state, so --udp lists bound sockets that have no remote peer. Windows does not report UDP peers, so there every bound UDP socket is listed, including short-lived client ones.

How it works

A short version (the long one is in ARCHITECTURE.md): whoisport asks the operating system which sockets are listening and which process owns each one, looks up details of those processes, and prints them. Each platform has its own small backend for that (/proc on Linux, lsof on macOS, the IP Helper API on Windows); everything else is shared.

cli ─► scan ─► output     (list, details, JSON)
         │
         └───► kill       (identity, safety rules, ask-then-force)
         ▲
   proc backend per OS · docker names

Development

cargo test                 # unit and end-to-end tests
cargo clippy --all-targets -- -D warnings

See CONTRIBUTING.md for the full workflow (formatting, coverage, checking the other platforms, commit style) and ARCHITECTURE.md for how the code is organised.

License

MIT

Metadata

Release files for whoisport 0.5.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whoisport 0.5.6
File Size Uploaded Provenance
whoisport-0.5.6.tar.gz 52.6 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for whoisport 0.5.6
File
whoisport-0.5.6-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
whoisport-0.5.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
whoisport-0.5.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
whoisport-0.5.6-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
whoisport-0.5.6-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 2.0 MB

Release files / whoisport-0.5.6.tar.gz

Download URL whoisport-0.5.6.tar.gz
Size 52.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c639e2f71007fc283b3b82d31597500b3c2c0eee573bc893ecee5b14eb45cfd6
BLAKE2b-256 checksum
How to use checksums
b745c3315e379c8c74daa5d935edc95b6580548b8c01074311640400c8b46739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / whoisport-0.5.6-py3-none-win_amd64.whl

Download URL whoisport-0.5.6-py3-none-win_amd64.whl
Size 396.1 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
7bc67b7c586dc42620eb7a9016e2f41335fd402ac703ade5a01bc5db5580dbde
BLAKE2b-256 checksum
How to use checksums
eed806b465e01988898f7c88821c27fb7dfdaf4b3261fb23232a27be623033bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / whoisport-0.5.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL whoisport-0.5.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 414.3 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
df786cdf18ff13940aa60eded5cbd3e862b716c990d59bd72b42c6ce482f8c59
BLAKE2b-256 checksum
How to use checksums
f100fc2cd54fa8b2f7a3a931e898000c2dc9944bc967e6faca0655bf270b2a17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / whoisport-0.5.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL whoisport-0.5.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 393.8 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
a953b75c12bdca81ec355e1ab89a2fe721321c2cee4bfe4e2889e6818946df0a
BLAKE2b-256 checksum
How to use checksums
7ff63cca615d97382f61dab81c8c185bc9235e3f59ed8c41d85ab760ed044c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / whoisport-0.5.6-py3-none-macosx_11_0_arm64.whl

Download URL whoisport-0.5.6-py3-none-macosx_11_0_arm64.whl
Size 365.5 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3581ae63187ad4dcac3b153d6ddfced7edd5e93acbc58988e19bb4e80fe5b110
BLAKE2b-256 checksum
How to use checksums
b3f41be8558d31e397ae69c32dc8fcdd9efa35d7f2453807b2f3a1f7088f7921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / whoisport-0.5.6-py3-none-macosx_10_12_x86_64.whl

Download URL whoisport-0.5.6-py3-none-macosx_10_12_x86_64.whl
Size 393.5 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
01d98d1f93940e61028a9589f4eda1c4346d0683aa19381f0725b80198d47d9d
BLAKE2b-256 checksum
How to use checksums
3a2aa5513c214ba7642ffced33de4530fbc7a3c7a3284ca20f1a5b27f883f3ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for whoisport 0.5.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for whoisport-0.5.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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