Skip to main content

Small CLI utility to find which process is using a TCP or UDP port

Project description

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.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

portwho-1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

portwho-1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file portwho-1.0.tar.gz.

File metadata

  • Download URL: portwho-1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for portwho-1.0.tar.gz
Algorithm Hash digest
SHA256 2f61faabf0ed69d26797748e605b621dd0ad40a7494b5d8675a236273f96d063
MD5 236765f63ca37e070fd2f2a5b3d7ebe9
BLAKE2b-256 a1449e1cba28d5b962c3ba3de4d672e50d292059d7f36beee18fb643af265acc

See more details on using hashes here.

File details

Details for the file portwho-1.0-py3-none-any.whl.

File metadata

  • Download URL: portwho-1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for portwho-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45f12f509b688b5e1e080f081a1814b88f7fbac1b3146ae0fca7582aab1bab0e
MD5 a0c44ea3ea4d5183232c2e98aa7118bd
BLAKE2b-256 deb5bd9d18fe4d018b343a36b19ad3e35c6b914cc89a3a364b5f0e8ce17adb1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page