Modern port and process management for macOS and Linux.
portx is a terminal-first tool for inspecting listening ports, mapping them back to processes, reviewing exposure scope, and taking action quickly. It is intended as a friendlier alternative to bouncing between netstat, lsof, and ps.
portx is currently focused on macOS and Linux.
Implemented today:
listto show listening portsinfoto inspect a specific portfindto search by process namekillto terminate the process behind a portwatchto refresh port details every secondtuifor an interactive terminal view--jsonoutput forlist,info, andfind
Planned later:
- Windows support
- More TUI polish and navigation
- Better automation integrations on top of the JSON contract
- Clear exposure scope detection:
PUBLIC,LAN,LOCAL - Port-oriented workflows instead of raw socket dumps
- Process-aware output with PID, name, command, user, and resource usage
- Friendly text output for humans and stable JSON output for tools
- Interactive TUI for live inspection
portx classifies listeners by where they are reachable from:
PUBLIC:0.0.0.0,::, and other globally reachable addressesLAN:10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10LOCAL:127.0.0.0/8,::1
Warnings are emitted for public wildcard or public global binds so risky listeners stand out quickly.
When GitHub Releases are available, download the archive for your platform, extract it, and move portx into a directory on your PATH.
Planned release artifact names:
portx-vX.Y.Z-aarch64-apple-darwin.tar.gzportx-vX.Y.Z-x86_64-unknown-linux-gnu.tar.gz
git clone <your-repo-url>
cd portx
cargo buildcargo run -- listcargo install --path .Example for macOS or Linux after downloading an archive:
tar -xzf portx-vX.Y.Z-<target>.tar.gz
cd portx-vX.Y.Z-<target>
chmod +x portx
mv portx /usr/local/bin/portxYou may choose a different destination as long as it is on your PATH.
portx
portx list [--scope public|lan|local] [--json]
portx <port>
portx info <port> [--pid <pid>] [--json]
portx find <process_name> [--scope public|lan|local] [--json]
portx kill <port> [--pid <pid>] [--force] [--yes]
portx watch <port> [--pid <pid>]
portx tuiportxwithout a subcommand behaves likeportx list.portx 3000is normalized toportx info 3000.killis conservative by default:- it sends
SIGTERMunless--forceis used - it asks for confirmation in interactive terminals
- in non-interactive contexts you must pass
--yes - if a port has multiple owning PIDs, you must pass
--pid
- it sends
- Some process metadata may be unavailable depending on OS permissions. In that case, text output shows
N/Aand JSON usesnull.
portxportx list --scope localportx info 5432portx info 3000 --pid 4242portx find nodeportx list --json
portx info 5432 --json
portx find postgres --jsonportx kill 3000portx kill 3000 --pid 4242 --force --yesportx watch 5432portx tuiUp/Down: move selectionEnter: toggle detail focusk: open kill confirmationy/n: confirm or cancel kill?/h: open or close helpEsc: leave focused detail mode or close overlaysq: quit
The TUI requires an interactive terminal.
list, info, and find support --json.
Design goals:
- stable field names for automation
- shared service-layer data for text and JSON output
- partial data is preserved instead of failing the whole command
When a value cannot be collected:
- text output shows
N/A - JSON output uses
null
This makes the JSON contract a good base for future wrappers such as editor integrations, shell workflows, or small automation services.
The project is organized into three broad layers:
src/platform: platform-specific socket and process collectionsrc/core: shared models, scope detection, warnings, and service logicsrc/outputandsrc/tui: CLI presentation, JSON output, text formatting, and terminal UI
This keeps collection concerns separate from user-facing presentation and makes later platform expansion easier.
Useful commands while working on the project:
cargo fmt --check
cargo clippy
cargo testSee also:
For other users, the most practical distribution options are:
- source install with
cargo install --path . - prebuilt archives from GitHub Releases
This repository includes a GitHub Actions workflow that builds release archives for:
- Apple Silicon macOS
- x86_64 Linux
Pushing a tag like v0.1.0 will build and upload release assets automatically.
- macOS and Linux only
- Windows is not part of the current implementation
- Some process and user fields depend on system permissions
- The TUI is intentionally lightweight in this phase and will continue to evolve
- Windows support
- More TUI navigation and detail ergonomics
- Improved filtering and sorting in the interactive view
- Better packaging and release workflow
- Optional higher-level integrations built on top of JSON output