
Sonar: Effortless Port and Process Management for Developers
Discover Sonar, an open-source tool that makes it easy to see, manage, and debug all ports and processes on your machine, with deep Docker integration and powerful CLI features.
Sonar: Effortless Port and Process Management for Developers
Have you ever found yourself running lsof or netstat commands, trying to figure out which process is hogging a port, or whether that process is a Docker container, a rogue dev server, or something else? If so, Sonar is the tool you’ve been waiting for.
What is Sonar?
Sonar is a powerful open-source CLI utility that helps you instantly see everything listening on your machine’s ports. It goes beyond basic process listing by showing Docker container names, Compose projects, resource usage, and even clickable URLs. With Sonar, you can:
- List all listening ports and see which processes or containers own them
- Kill processes or stop containers by port number
- Tail logs, shell into containers, and more
- Visualize service dependencies and connections
- Find free ports, map ports, and wait for services to be ready
Key Features
- Comprehensive Port Listing:
sonar listshows all ports, processes, containers, and URLs in a clear table. - Docker Integration: See container names, images, and Compose projects alongside native processes.
- Resource Usage: Add
--statsto see CPU, memory, and uptime for each service. - Process Management: Kill processes or containers directly by port, or stop all services in a Compose project.
- Logs and Shell Access: Tail logs or shell into containers with a single command.
- Dependency Graphs: Visualize which services talk to each other with
sonar graph. - Profiles: Save and restore sets of expected ports for projects.
- Cross-Platform: Works on macOS, Linux, and Windows.
Installation
- macOS/Linux:
sh
curl -sfL https://raw.githubusercontent.com/raskrebs/sonar/main/scripts/install.sh | bash - Windows (PowerShell):
powershell
irm https://raw.githubusercontent.com/raskrebs/sonar/main/scripts/install.ps1 | iex - Go:
sh
go install github.com/raskrebs/sonar@latest
Example Usage
- List all ports:
sh
sonar list - Show resource stats:
sh
sonar list --stats - Inspect a port:
sh
sonar info 3000 - Kill a process by port:
sh
sonar kill 3000 - Tail logs:
sh
sonar logs 3000 - Visualize dependencies:
sh
sonar graph
Why Use Sonar?
Sonar streamlines the often tedious process of port and process management for developers. Whether you’re debugging a local dev environment, managing Docker containers, or just want a clear view of what’s running, Sonar makes it effortless.
Check out the Sonar GitHub repository for more details, installation options, and advanced usage tips.
Know what’s running on your machine—instantly—with Sonar.
Share this post