✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: March 20, 2026
  • 6 min read

Introducing Sonar CLI: Powerful Port Management for Developers

The sonar CLI is an open‑source command‑line tool that delivers instant network monitoring and precise port management for developers and system administrators, allowing you to list, inspect, kill, and even map services listening on localhost with Docker‑aware insights.

Sonar CLI: The Ultimate Open‑Source Network Monitoring & Port Management Tool

When you’re juggling multiple containers, local servers, and background processes, figuring out which port belongs to which service can become a time‑consuming nightmare. GitHub sonar repository solves this problem with a single binary that scans localhost, correlates ports with Docker containers, Compose projects, and native processes, and presents the data in a clean, sortable table.

Beyond simple listing, sonar offers one‑click actions—kill, tail logs, attach a shell, run health checks, and even create reusable profiles—making it a Swiss‑army knife for network monitoring and port management on macOS and Linux.

Sonar CLI Overview

Core Features and Capabilities

Comprehensive Port Listing

  • Shows port number, process name, PID, Docker container, image tag, and URL.
  • Filters for Docker, user‑owned services, or all processes with --filter flags.
  • Sortable columns (name, CPU, memory, uptime) for quick prioritisation.

One‑Click Process Control

  • Terminate a process with sonar kill <port> (SIGTERM) or force‑kill (SIGKILL).
  • Stop Docker containers gracefully via docker stop under the hood.
  • Batch kill with sonar kill-all using filters for Docker, Compose projects, or user processes.

Live Logs & Shell Access

  • Tail Docker logs or native process logs automatically.
  • Open an interactive shell inside a container or connect via TCP with sonar attach.
  • Fallback to system log streams on macOS or /proc on Linux.

Health Checks & Dependency Graphs

  • Run HTTP health probes on listening ports with --health.
  • Generate a visual dependency graph (DOT, JSON) to see which services talk to each other.
  • Export data for CI pipelines or monitoring dashboards.

Installation and Setup Steps

Sonar is distributed as a single binary. The quickest way to install is via the official install.sh script:

curl -sfL https://raw.githubusercontent.com/raskrebs/sonar/main/install.sh | bash

This script places the binary in ~/.local/bin and adds it to your PATH. If you prefer a custom location, set the SONAR_INSTALL_DIR environment variable:

curl -sfL https://raw.githubusercontent.com/raskrebs/sonar/main/install.sh | SONAR_INSTALL_DIR=/usr/local/bin bash

After installation, reload your shell configuration (source ~/.zshrc or source ~/.bashrc) to make sonar available.

Shell Completion

For a smoother experience, enable tab‑completion for port numbers:

  • Zsh: sonar completion zsh > "${fpath[1]}/_sonar"
  • Bash: sonar completion bash > /etc/bash_completion.d/sonar
  • Fish: sonar completion fish | source

Common Usage Scenarios and Commands

1. Quick Port Overview

List every listening port with Docker context:

sonar list

2. Filtered Views

Show only Docker‑managed ports:

sonar list --filter docker

Or focus on user‑started services:

sonar list --filter user

3. Detailed Port Inspection

Get a full snapshot of port 3000 (process command, resource usage, health check, Docker details):

sonar info 3000

4. Killing Stale Services

Terminate a rogue process listening on port 8080:

sonar kill 8080

Force‑kill if the process ignores SIGTERM:

sonar kill 8080 -f

5. Live Log Streaming

Tail logs for a Docker container bound to port 5432:

sonar logs 5432

6. Remote Monitoring via SSH

Inspect a remote host without leaving your terminal:

sonar list --host user@remote‑server

7. Profile Management for Projects

Save a snapshot of expected ports for a micro‑service stack:

sonar profile create my‑app

Later, verify that all required ports are up:

sonar up my‑app

8. Port Mapping (Proxy)

Expose an internal port 6873 on an alternative public port 3002:

sonar map 6873 3002

Repository Statistics (as of March 2026)

Metric Value
Stars 11
Forks 1
Releases 3 (latest v0.1.3 – Mar 20 2026)
Primary Language Go (≈96 %)
Contributors 1 core maintainer (RaskKrebs) + community PRs
License MIT – permissive for commercial use

Why Sonar Is a Game‑Changer for Developers and System Administrators

Traditional tools like lsof or netstat provide raw socket data but lack context. Sonar bridges that gap by correlating ports with Docker metadata, Compose project names, and resource consumption—all in a single, sortable view.

For developers, this means:

  • Faster debugging of port collisions during local development.
  • One‑click access to container logs without remembering container IDs.
  • Ability to enforce a “profile” of expected services, reducing CI flakiness.

For sysadmins, sonar offers:

  • Quick audit of exposed services on production servers.
  • Remote monitoring via SSH without installing heavy agents.
  • Automated health checks that can be integrated into alerting pipelines.

Leveraging Sonar Within the UBOS Ecosystem

UBOS provides a unified platform for building, deploying, and monitoring AI‑enhanced applications. While sonar focuses on low‑level port visibility, you can combine it with UBOS’s higher‑level services for a full‑stack observability stack.

For example, after identifying a misbehaving container with sonar, you could use the Workflow automation studio to trigger a remediation playbook that restarts the container, notifies the team via Slack, and logs the incident in your audit trail.

Similarly, the AI marketing agents can be configured to monitor the health of public‑facing services (e.g., a landing‑page API) and automatically adjust ad spend when latency spikes are detected.

Developers building micro‑services can also benefit from the UBOS templates for quick start, such as the AI SEO Analyzer or the AI Article Copywriter, which already embed health‑check hooks that can be fed sonar data.

Get Started with Sonar and UBOS Today

Ready to eliminate port‑guesswork and boost your development velocity? Install sonar now, then explore how UBOS can turn those insights into automated workflows.

With sonar’s granular visibility and UBOS’s powerful automation, you’ll spend less time firefighting and more time delivering value.

Further Reading & Tools

Enhance your workflow with these UBOS‑hosted AI utilities that complement sonar’s low‑level monitoring:


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.