Skip to main content

See what's running on your local ports

Project description

devports

See what's running on your local ports.

PyPI Python License CI

A developer-friendly CLI that scans your local ports, identifies what's running on each one, checks service health, and displays everything in a clean terminal table.

                          Local Services
 ---------------------------------------------------------------
  PORT  | SERVICE              | STATUS          | ADDRESS
 ---------------------------------------------------------------
  3000  | next-dev             | ● healthy (3ms) | 127.0.0.1
  5173  | vite                 | ● healthy (1ms) | 127.0.0.1
  5432  | postgres   [docker]  | ● healthy (2ms) | 0.0.0.0
  6379  | redis      [docker]  | ● healthy (1ms) | 0.0.0.0
  8000  | fastapi              | ● healthy (5ms) | 127.0.0.1
  8080  | api-server           | ● down          | 0.0.0.0
  9090  | prometheus [docker]  | ● healthy (4ms) | 0.0.0.0
 ---------------------------------------------------------------
 7 service(s) found

Features

  • Port scanning -- discovers all listening TCP ports via ss
  • Service identification -- maps ports to friendly names using a built-in database of 30+ common services, process name matching, and command-line analysis
  • Docker integration -- detects Docker containers and tags them accordingly
  • Health checking -- probes each port with a TCP connection and reports healthy/down/unknown with response time in milliseconds
  • JSON output -- structured output for scripting and piping
  • Live watch mode -- auto-refreshing view that updates as services start and stop
  • Open in browser -- launch a service by port number or name
  • Kill by port -- terminate a process by the port it listens on
  • PID and command display -- optional columns showing process IDs and full command lines

Installation

pip install devports

Requires Python 3.10+ and a Linux system with ss available (standard on all modern distributions).

Usage

Scan all ports

devports

Show process IDs

devports --pid

Show full command lines

devports --cmd

Skip health checks

devports --no-health

JSON output

devports --json

Returns a JSON array with port, service, pid, process, address, tags, and health information for each entry. Useful for scripting:

devports --json | jq '.[].service'

Live watch mode

devports watch
devports watch --interval 5
devports watch --pid

Auto-refreshing terminal UI. Updates every 2 seconds by default. Press Ctrl+C to stop.

Open a service in the browser

devports open 3000
devports open next-dev

Accepts a port number or a service name (partial match). Uses xdg-open or wslview on WSL.

Kill a process by port

devports kill 8080

Sends SIGTERM to the process listening on the given port.

How It Works

  1. Scan -- Reads listening TCP sockets from ss -tlnpH and enriches each entry with data from /proc (command line, process name)
  2. Identify -- Matches each port against a known-port database, maps process names to service names, and parses command lines to detect frameworks (Next.js, Vite, FastAPI, Django, Spring, etc.)
  3. Docker -- Queries docker ps to match published port bindings to container names and tags them with [docker]
  4. Health check -- Opens a TCP connection to each port and measures response time; reports healthy, down, or unknown
  5. Display -- Renders a formatted table using Rich, or outputs structured JSON

Service Detection

devports uses four layers to identify what is running on each port:

Layer Method Example
Docker containers docker ps port bindings postgres container on 5432
Process name map Match process name to known services redis-server -> redis
Known port database 30+ common dev ports 5173 -> vite, 9092 -> kafka
Command-line analysis Parse cmdline for framework keywords node .../next/... -> next-dev

Layers are evaluated in order. The first match wins.

For generic runtimes like node, python, and java, devports inspects the full command line to detect specific frameworks: Next.js, Vite, Nuxt, Remix, Express, NestJS, Django, Flask, FastAPI, Gunicorn, Jupyter, Spring, and Tomcat.

Contributing

git clone https://github.com/Ltbltbltbltb/devports.git
cd devports
pip install -e ".[dev]"
pytest
ruff check src/

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

devports-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

devports-0.1.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file devports-0.1.0.tar.gz.

File metadata

  • Download URL: devports-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for devports-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3e740e33f4182ef1aa8ed5003d7dfe4ef624abc94e838dc78e7c1286ea866d4
MD5 51b5d299100940e7694b4bf8180c8c8b
BLAKE2b-256 c2125585770963959637c47b5f9bfefa3c6f63ff22ab91968f66da429f98957d

See more details on using hashes here.

File details

Details for the file devports-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: devports-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for devports-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 336905c5482237baa195fc26e0964b2c751af906494af9f6f68d470c1a677508
MD5 46571b05e914b987268ad44abce39784
BLAKE2b-256 88127df130594ae09725e8c6fe0ce7acc66a69a5c9a81e0a87b3a74857cef422

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