Skip to main content

Local port management CLI — list, kill, watch, and snapshot listening ports

Project description

portsmith

A local port management CLI for macOS and Linux.

Installation

pip install portsmith

Or install from source:

git clone <repo>
cd portsmith
pip install -e .

Commands

portsmith list

Show all listening ports with PID, process name, port, protocol, and status. System ports (<1024) are highlighted in yellow, user ports in green.

portsmith list

# Only show ports opened from this terminal session
portsmith list --mine

# Machine-readable JSON output
portsmith list --json

--mine note: this flag filters to processes running under your OS user account. It removes system services (svchost, lsass, etc.) but will still show other user-owned background apps that happen to listen on ports (e.g. Chrome, cloud sync clients). It correctly catches dev servers started in any shell or terminal window.

portsmith kill <port>

Kill the process listening on a given port. Asks for confirmation unless --force is passed.

portsmith kill 8080

# Skip confirmation
portsmith kill 8080 --force
portsmith kill 8080 -f

portsmith watch

Live-updating view of all active ports, refreshing every 2 seconds. New ports are highlighted green, closed ports red. Exit with Ctrl+C.

portsmith watch

# Only watch ports opened from this terminal session
portsmith watch --mine

portsmith save <name>

Save a snapshot of all currently active user ports (port ≥1024) to ~/.portsmith/profiles/<name>.json.

portsmith save myproject
portsmith save dev-stack

portsmith restore <name>

Check a saved profile against currently running ports. Shows which saved processes are still running and which are missing, along with hints for restarting them.

portsmith restore myproject

portsmith profiles

List all saved profiles with their creation timestamp and port count.

portsmith profiles

Requirements

  • Python 3.10+
  • macOS or Linux (Windows is not supported)

Notes

  • Ports below 1024 are system ports and may require sudo to kill.
  • portsmith restore does not restart processes — it only reports their status and suggests what needs to be restarted.
  • Profiles are stored in ~/.portsmith/profiles/ as JSON files.

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

portsmith-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

portsmith-0.1.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: portsmith-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for portsmith-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d067a8d0730c167b4f4d85f75271d1ee828995254f02a5bd61a71ac95041a39c
MD5 e619825029706012162fa682bacd941e
BLAKE2b-256 d21b6e7e6f14491baeb2f730f468368d295a2ff2f3f785237acf0b0ec2fe02e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: portsmith-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for portsmith-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4c89d653c791d99968a85c7d77ca5ea35c9967416624886b60f102ddc6b5e00
MD5 bbb663a54f3e393105b42aac52605af0
BLAKE2b-256 fbaa0db14165704a560ae13dcbcb8e508e9dce1d382e68a1ea31a46140cdcd2a

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