Skip to main content

Manage your ports — view, inspect, and kill processes on TCP ports

Project description

portctl

Manage your ports.

A cross-platform Python CLI tool for viewing, managing, and killing processes on TCP ports.

Inspired by port-whisperer by Larsen Cundric.

What it looks like

$ portctl

 ┌──────────────────────────────────────────┐
  portctl                                    scanning your ports...                    └──────────────────────────────────────────┘

  PORT    PROCESS      PID     PROJECT       FRAMEWORK      UPTIME   MEM        BIND     STATUS
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  :8000   python.exe   14320   payments-api  FastAPI        3h 12m   48.7 MB   public    healthy
  :5173   node         52981   dashboard     Vite           22m      112.4 MB  local     healthy
  :8080   go           8734    gateway       Go             6d 1h    23.1 MB   public    healthy
  :5432   docker       7712                 Docker (PG)    14d 8h   67.0 MB   local     healthy

  4 ports active  ·  Run portctl <port> for details  ·  --all to show everything
$ portctl 5173

 ┌─────────────────────── Port :5173 ───────────────────────┐
                                                              Process     node                                           PID         52981                                          Status       healthy                                      Framework   Vite                                           Memory      112.4 MB                                       Uptime      22m                                            Started     2026-04-04 10:15:42                            Bind        local (127.0.0.1)                              Command     node node_modules/.bin/vite --port 5173                                                                   Directory   /home/mubarak/projects/dashboard               Project     dashboard                                      Git Branch  feat/charts                                                                                               Process Tree                                                  node (52981)                                               └─ bash (52900)                                              └─ tmux: server (1120)                                                                                        └──────────────────────────────────────────────────────────┘

  Run portctl kill 5173 to stop  ·  portctl cmd 5173 to see startup command
$ portctl 8000-8100

  :8000 python.exe (PID 14320) [FastAPI]
  :8001 free
  :8002 free
  ...
  :8080 go (PID 8734) [Go]
  :8081 free
  ...
  :8100 free
$ portctl free 5173 -- npm run dev

   Killed node (PID 52981) on port 5173
  Running: npm run dev
$ portctl kill 8000 8080

   Killed python.exe (PID 14320) on port 8000
   Killed go (PID 8734) on port 8080

Install

pip install portctl
# or
pipx install portctl

Quick Start

portctl                    # Show dev server ports
portctl 3000               # Inspect what's on port 3000
portctl kill 3000           # Kill it

Commands

List ports

portctl                    # Dev server ports only
portctl --all              # All listening ports
portctl --sort mem         # Sort by memory (also: uptime)
portctl -f django          # Filter by process, framework, or project
portctl -n 5               # Limit to top N rows

Inspect a port

portctl 3000               # Detail view if occupied, "available" if free

Shows process info, framework, memory, uptime, bind address, working directory, git branch, and process tree.

Scan a range

portctl 8000-9000          # Show which ports are in use

Kill processes

portctl kill 3000          # Kill process on port 3000
portctl kill 3000 8080     # Kill multiple ports
portctl kill 3000 --force  # Force kill (SIGKILL)
portctl kill 3000 --dry-run  # Preview without killing

Free a port and run a command

portctl free 3000 -- npm start      # Kill port 3000, then run npm start
portctl free 3000 5432 -- docker compose up  # Free multiple, then run

Show startup command

portctl cmd 3000           # Print the command that started the process
portctl cmd 3000 --copy    # Copy it to clipboard

Utilities

portctl open 3000          # Open http://localhost:3000 in browser
portctl copy 3000          # Copy http://localhost:3000 to clipboard
portctl clean              # Kill orphaned/zombie dev processes
portctl clean --dry-run    # Preview without killing

Features

  • Cross-platform -- works on macOS, Linux, and Windows
  • Framework detection -- identifies Next.js, Vite, Django, FastAPI, Flask, Express, and 20+ others
  • Project detection -- finds project root and name from package.json, pyproject.toml, Cargo.toml, etc.
  • Smart filtering -- shows only dev processes by default, use --all for everything
  • Protected processes -- refuses to kill system-critical processes (systemd, lsass, etc.)
  • Git branch -- shows which branch each process is running from

Platform Support

Platform Status
macOS Supported (use sudo for full visibility)
Linux Supported
Windows Supported (admin recommended for full PID visibility)

License

MIT

Project details


Download files

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

Source Distribution

portctl-0.1.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

portctl-0.1.1-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: portctl-0.1.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for portctl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9bd2403ed3eb68a3943046c245706f69545fbf32871a5d9d6ad4278d91621590
MD5 49d4c3130707d5ffd41ef40242c3351e
BLAKE2b-256 ff87741fbac72ce9003118ca5d47bd84792b9fc49c8573cf06cf4ea19ca684d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for portctl-0.1.1.tar.gz:

Publisher: release.yml on mubbie/portctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file portctl-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: portctl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for portctl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49106d96837b8a2999e1c09d9d45864f8bdb9a76615fbb7d1c0228ec40c778d3
MD5 55b4991522eaa711a9423ab36ebbc846
BLAKE2b-256 d34e2cbf1094ecf64690f8fbf2aeb60e8a808323480873e40b572b5ab0c32671

See more details on using hashes here.

Provenance

The following attestation bundles were made for portctl-0.1.1-py3-none-any.whl:

Publisher: release.yml on mubbie/portctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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