RasKrebs' sonar is a CLI tool for inspecting and managing everything listening on localhost ports. The name is overloaded, and badly, but the tool works well.
The pitch is in the README: the author got tired of running lsof -iTCP -sTCP:LISTEN | grep ... every time a port was already taken, then spending another minute figuring out whether it was a Docker container or an orphaned dev server. So they built something more suitable for their purposes. sonar list gives you ports, process names, Docker container names, Compose projects, CPU/memory usage, and clickable URLs in one shot. From there you can kill processes, tail logs, shell into containers, watch for port changes with desktop notifications, inspect inter-service connections as a dependency graph, and snapshot port sets as named profiles.
It runs on macOS (via lsof) and Linux (via ss), is written in Go, and installs with a one-liner. The feature surface is wider than you'd expect for a project at this stage in its lifecycle: sonar watch, sonar graph, sonar profile, sonar map (proxies one port to another), and even a macOS system tray widget are all present and accounted for.
Name collision aside, this is exactly the kind of tool you install once and immediately forget how you lived without it. Seems worth having.