Skip to main content

A terminal UI for monitoring and managing local listening ports

Project description

porTUI

A terminal UI application for monitoring local listening ports and managing the processes that own them.

Features

  • Real-time display of listening TCP/UDP ports with process information
  • Configurable columns (Port, IP, Protocol, Process, PID, User, State, Command)
  • Sortable by Port, IP, Protocol, Process, PID, User, State, or Command (numerical IP sorting)
  • Sort order maintained during auto-refresh
  • Inline tree view with real process hierarchy (toggle with t) — parent processes are resolved from the OS even when they don't hold ports (e.g. Chrome → Chrome Helper)
  • Protocol filter to show TCP only, UDP only, or both (cycle with h)
  • Real-time text filtering across all fields
  • Port detail overlay with full untruncated command line (press Enter, Escape to close)
  • Auto-refresh with configurable interval (pauses during interaction)
  • Prominent visual indicator when auto-refresh is paused
  • Kill processes with choice of graceful (SIGTERM) or force (SIGKILL), with PID recycling guard
  • Configuration persistence (~/.config/portui/config.json)
  • Cross-platform (macOS, Linux, Windows)

Installation & Usage

Run without installing (recommended)

uvx portui

Install globally

uv tool install portui
portui

Install with pip

pip install portui
portui

Run from source

git clone https://github.com/lowtrak/PorTUI
cd PorTUI
uv sync
uv run portui

Run as a module

uv run python -m portui

Keyboard Shortcuts

Key Action
↑/↓ or j/k Navigate rows
Enter Show full port/process details
/ Focus filter input (Escape to clear and exit)
h Cycle protocol filter (Both → TCP → UDP)
c Toggle column configuration
s Cycle sort column (Port → IP → Proto → Process → PID → User → State → Command); active sort shown in title bar
t Toggle tree view (htop-style process hierarchy)
x Kill selected process
r Manual refresh
p Pause/resume auto-refresh
i Set refresh interval
? Show help
q Quit

Requirements

  • Python 3.9+
  • uv (for uvx usage)

Platform notes

macOS

psutil.net_connections() requires root on macOS and will raise a permission error when called as a normal user. PorTUI works around this by iterating connections per-process instead, which only skips processes you don't have access to (typically kernel/system processes). No sudo required.

Development

git clone https://github.com/lowtrak/PorTUI
cd PorTUI
uv sync --group dev
uv run pytest

Project structure

portui/
├── __init__.py      # Public exports
├── __main__.py      # python -m portui entry point
├── app.py           # PortUIApp (main TUI application)
├── collector.py     # PortDataCollector (psutil, kill logic)
├── config.py        # ConfigManager (load/save/validate)
├── models.py        # PortInfo dataclass
├── screens.py       # All Screen subclasses
├── sort.py          # SortController
└── tree.py          # ProcessTreeBuilder (htop-style tree)

tests/
├── test_config.py   # ConfigManager validation (15 tests)
├── test_filter.py   # Filter mode UI (8 tests)
├── test_kill.py     # Kill + PID recycling guard (9 tests)
├── test_sort.py     # Sort all columns (21 tests)
└── test_tree.py     # Tree view (7 tests)

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

portui-0.2.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

portui-0.2.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file portui-0.2.0.tar.gz.

File metadata

  • Download URL: portui-0.2.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for portui-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a2ed36e3b4722672a97b327f9488ffce6503e44812747f8f7771496dac2231e1
MD5 0742cb24d624ba2a07e478991ffe2bd3
BLAKE2b-256 6c03bfbf5588120fe85cccb37473e816c4cb6ad7ae4250529b63afb486b67e9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for portui-0.2.0.tar.gz:

Publisher: publish.yml on lowtrak/PorTUI

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

File details

Details for the file portui-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: portui-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for portui-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48c9c82c9806b96c137071e3758b5595b92f8a078d97d8d5030b10321f9c17f9
MD5 9e03c5e06aead9113c067f1b5bb83d50
BLAKE2b-256 8cb90bb7ecfaedeee90f30ea9a6a609fdc6a0ee51b041e2445063c55a3386d8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for portui-0.2.0-py3-none-any.whl:

Publisher: publish.yml on lowtrak/PorTUI

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