LAUNCHES

Rasmus Krebs Releases Sonar: A Go CLI for Localhost Port Management

R Ryan Matsuda Mar 21, 2026 Updated Apr 7, 2026 4 min read
Engine Score 7/10 — Important

This story introduces a highly actionable CLI tool that simplifies managing local processes for developers. While not a groundbreaking innovation, its convenience and direct utility make it a notable resource for improving development workflows.

Developer Rasmus Krebs published Sonar, an open-source command-line tool written in Go that lists, inspects, and manages all services listening on localhost ports. The project, licensed under MIT, had accumulated 873 GitHub stars and 24 forks as of early April 2026, indicating rapid uptake among developers frustrated by fragmented port-debugging workflows.

  • Sonar replaces ad-hoc lsof and grep pipelines with a single sonar list command that surfaces port number, process name, Docker metadata, resource usage, and clickable URLs in a structured table.
  • The tool handles termination differently per process type: SIGTERM or SIGKILL for native processes, and docker stop for containers to respect Docker’s graceful shutdown lifecycle.
  • Additional capabilities include SSH-based remote scanning, HTTP health checks, log tailing, and interactive shell access into containers — all referenced by port number rather than container ID.
  • Installation requires a single curl command that places the binary in ~/.local/bin and configures PATH settings automatically, with shell completion available for zsh, bash, and fish.

What Happened

Krebs published Sonar as a public repository at github.com/RasKrebs/sonar. The tool is built in Go and targets developers who run multiple concurrent local services — web servers, databases, Docker containers, and build watchers — and need a faster way to identify and act on port conflicts than manually constructing shell pipelines.

Krebs described his motivation directly in the project’s README: “I got tired of running lsof -iTCP -sTCP:LISTEN | grep ... every time a port was already taken, then spending another minute figuring out if it was a Docker container or some orphaned dev server from another worktree. So I built sonar.”

Why It Matters

Port conflicts are a routine friction point in local development, particularly in environments that combine native processes, Docker Compose stacks, and multiple concurrent project worktrees. Existing platform utilities — lsof, ss, netstat — were not designed to surface Docker metadata or provide integrated process control, requiring developers to piece together information from several separate commands.

Sonar addresses this by treating the local port space as a single inspectable interface. Each port entry is enriched with container names, Compose project labels, resource metrics, and a directly usable URL. The approach is comparable to tools like lazydocker and htop, which surface system state in a unified view without requiring users to remember complex flag combinations across multiple binaries.

Technical Details

The core command, sonar list, renders a structured table showing port number, process name, Docker container name, associated image, Compose project affiliation, current resource usage, and a clickable URL where applicable. Results can be filtered by process type and sorted by multiple criteria, and JSON export is supported for piping output into other tools or scripts.

Process termination is handled per process type. For native processes, Sonar sends either SIGTERM or SIGKILL depending on user instruction. For Docker containers, the tool issues a docker stop command rather than sending a signal directly to the container’s internal PID, which preserves Docker’s graceful shutdown behavior and avoids bypassing container lifecycle hooks.

Beyond listing and killing, Sonar supports tailing logs and opening an interactive shell inside containers, both triggered by port number rather than container ID or name. The tool also includes SSH support for scanning services on remote machines and HTTP health check functionality to probe whether a service on a given port is responding — useful for verifying that a process is not just bound but actively serving.

Shell completion is available for zsh, bash, and fish, enabling tab-completion of port numbers. The repository contains 37 commits across its history, with 7 open issues and 2 open pull requests at the time of writing.

Who’s Affected

The primary audience is individual developers and small teams running mixed local environments — projects that combine containerized microservices with native processes such as language runtimes, database servers, or reverse proxies. The Docker-specific integrations, including Compose project detection and container-aware shutdown, make the tool particularly relevant for anyone managing multi-service development stacks locally.

DevOps engineers who SSH into remote development or staging machines may also benefit from the remote scanning feature, which extends Sonar’s inspection capabilities beyond the local machine without requiring a separate toolchain or manual lsof invocations over SSH.

What’s Next

The repository contains a tray directory in its file tree, which suggests exploratory work toward a system tray companion application. No stable release of that component was documented at the time of writing, and its scope and timeline were not specified in the project README.

As an MIT-licensed project, Sonar accepts external contributions via pull request. Developers interested in extending support to additional container runtimes — such as Podman or containerd — or adding further filtering and export options can contribute directly to the repository.

Related Reading

Share

Enjoyed this story?

Get articles like this delivered daily. The Engine Room — free AI intelligence newsletter.

Join 500+ AI professionals · No spam · Unsubscribe anytime