Skip to main content

portwho

Small CLI utility to find which process is using a port and optionally stop it.

What it does

portwho helps you:

  • inspect a TCP or UDP port
  • see which process is bound to that port
  • view basic process information
  • optionally terminate that process
  • optionally force kill it if graceful termination does not work

This is useful when a local server fails to start because a port is already occupied.

Features

  • supports TCP and UDP
  • shows PID, process name, executable path, command line, and status
  • groups listeners by process
  • can terminate processes on the target port
  • supports graceful stop with optional force kill fallback
  • simple terminal output

Installation

Clone the repository and install it in a virtual environment.

git clone <your-repo-url>
cd portwho
pip install -e .

Requirements

  • Python 3.10+
  • psutil

Usage

Basic form:

portwho <port>

Examples:

portwho 8000
portwho 8000 --protocol tcp
portwho 53 --protocol udp
portwho 8000 --kill
portwho 8000 --force

Command line arguments

port

Target port number.

Example:

portwho 8000

--protocol {tcp,udp}

Choose which protocol to inspect.

Default:

tcp

Examples:

portwho 8000 --protocol tcp
portwho 53 --protocol udp

--kill

Try to stop processes using the port.

Example:

portwho 8000 --kill

--force

If normal termination times out, force kill the process.

Example:

portwho 8000 --force

Notes

  • process termination may fail due to insufficient permissions
  • some system or protected processes may not expose full metadata

License

MIT License.

Metadata

Release files for portwho 1.0

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

Source distribution (sdist)

Source distribution for portwho 1.0
File Size Uploaded
portwho-1.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for portwho 1.0
File Interpreter ABI Platform
portwho-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / portwho-1.0.tar.gz

Download URL portwho-1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2f61faabf0ed69d26797748e605b621dd0ad40a7494b5d8675a236273f96d063
BLAKE2b-256 checksum
How to use checksums
a1449e1cba28d5b962c3ba3de4d672e50d292059d7f36beee18fb643af265acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / portwho-1.0-py3-none-any.whl

Download URL portwho-1.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45f12f509b688b5e1e080f081a1814b88f7fbac1b3146ae0fca7582aab1bab0e
BLAKE2b-256 checksum
How to use checksums
deb5bd9d18fe4d018b343a36b19ad3e35c6b914cc89a3a364b5f0e8ce17adb1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.0 This release

2 release 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