frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Sonar – A tiny CLI to see and kill whatever's running on localhost

https://github.com/RasKrebs/sonar
38•raskrebs•4h ago

Comments

raskrebs•4h ago
I always have a bunch of local projects running, particularly during the weekend where I'm rarely working on one thing at a time. A big pain of mine was constantly running into port: Redis from one project blocking another, orphaned dev servers from old worktrees, Docker containers I forgot about. The usual fix is lsof -iTCP | grep ..., then figuring out what the PID actually is, then killing it. But I always forget the command, and it doesn’t really include all the information that I like.

So I built this lightweight CLI. Single binary, no dependencies. It shows everything listening on localhost with process names, Docker container info, clickable URLs etc.

Sure there are workarounds, but none that satisfied my need for a short, easily rememberable command. Also nothing really has the same satisfaction as running sonar kill 3000 — it just feels nice. I’ve already been approached by a few agent orchestration tools that have been struggling with the same thing. It's really useful when you have multiple agents running, but it's not built for just that use case, I have also find it handy when killing off all containers after a failed cleanup and so on. Also know that MCPs are dead and CLIs are the new thing in agentic coding, this might be a useful tool for Claude, particularly when a compose process exits before all containers are stopped.

Open for contributions, ideas and feedback.

pluc•1h ago
Have a look at Evan Hahn's murder util: https://codeberg.org/EvanHahn/dotfiles/src/commit/843b9ee13d...
raskrebs•1h ago
Will check it out
embedding-shape•1h ago
> I’ve already been approached by a few agent orchestration tools that have been struggling with the same thing

Wow, this says more about the agent orchestration tool ecosystem than what you might think, that they're unable to kill child processes they themselves spawn makes it seem like they have zero clue about what they're doing.

Probably why my impression always end up with "Wow, what a vibe-coded mess" when I look through the source of all these harnesses, they don't seem engineered at all.

Bradd3rs•2h ago
love this, i get tired of spamming lsof -i tcp:xxxx
raskrebs•2h ago
Glad to hear! Have quite a few ideas in mind so keep an eye out for some updates (one of the ideas is an easy update command). There's a couple of open enhancement ideas as well. Feel free to add any or contribute.
Doublon•1h ago
The README made me realize I just needed a simple `alias local-tcp-listeners='lsof -iTCP -sTCP:LISTEN'` in my `~/.bash_aliases` :)
deadbabe•1h ago
Same, not sure why a whole cli app is needed.
paddim8•1h ago
Because it gives more context. Quite obvious if you look at the readme...
raskrebs•1h ago
Developers are nitpicky, atleast i am and i know a lot of others that are as well. So don't underestimate the value of a nice tool with good developer experience, one that's intuitive, clean and easy to use means a lot when juggling so many things during a workday. So having a clean and light implementation to make job even easier is in my opinion worth it (and thus needed) :)
raskrebs•1h ago
True, but as i write their are workarounds, the problem is that they are unintuitive, difficult to remember and don't provide all that much usability beyond listing. So these lack useful features like getting process stats, killing ports easily without having to remember the the pid after lsof and so on. I often have to kill multiple process at once after a failed cleanup. If you are into agentic coding, then having your agent create a profile for all the processes it stats, which it can easily kill of when finished is a lot easier for me atleast.

Some features on the way are: next available port; wait (wait for a host to return a successful health check before proceeding - good for migrations etc.). And lots more. It's not just about listing running ports, but a tool for managing them.

But to each their own, that's what's lovely about the many options available. But if you have anything in relation to this you think is neat, feel free to open an issue. It may be able to convince you that a simple alias won't suffice.

klaushardt•1h ago
Would be nice to have a flag to customize the URL displayed for Docker containers. I connect to my host via Tailscale, but I can’t open links with localhost. It would be helpful to have a parameter that allows us to choose a network device or specify an IP address to display.

    3000    wud (getwud/wud:latest)                            wud          getwud/wud:latest                       3000    http://localhost:3000
    3001    dockhand (fnsys/dockhand:latest)                   dockhand     fnsys/dockhand:latest                   3000    http://localhost:3001
raskrebs•4m ago
Good point. Could you add an issue, then i'll have a chance to look into it :)

https://github.com/RasKrebs/sonar/issues

frankdenbow•47m ago
love this, happens too often
moezd•37m ago
Sonar as in SonarQube? That's an interesting choice for a name :)
beart•12m ago
How about Sonar as in SOund Navigation And Ranging?
chwzr•18m ago
i have this in my .zshrc which provides same functionality:

  lk() {
    if [ $# -eq 0 ]; then
        local output=$(sudo lsof -iTCP -sTCP:LISTEN -n -P)
    elif [ $# -eq 1 ]; then
        local output=$(sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color=always $1)
    else
        echo "find and kill processes listening on ports. Usage: lk [pattern]"
        return 1
    fi

    if [ -z "$output" ]; then
        echo "No listening processes found."
        return 0
    fi

    # Show header + results
    echo "$(sudo lsof -iTCP -sTCP:LISTEN -n -P | head -1)"
    echo "$output"
    echo ""

    # Extract unique PIDs (skip the header row if no grep was applied)
    local pids=($(echo "$output" | awk '{print $2}' | grep -E '^[0-9]+$' | sort -u))

    if [ ${#pids[@]} -eq 0 ]; then
        echo "No PIDs found."
        return 0
    fi

    echo "PIDs to kill: ${pids[*]}"
    echo -n "Kill these ${#pids[@]} process(es)? [y/N] "
    read -r confirm

    if [[ "$confirm" =~ ^[Yy]$ ]]; then
        for pid in "${pids[@]}"; do
            echo "Killing PID $pid..."
            sudo kill -9 $pid
        done
        echo "Done."
    else
        echo "Aborted."
    fi
  }
pdimitar•12m ago
I am absolutely installing this and starting to use it daily!

For the even less patient there's also this (not mine): https://github.com/jkfran/killport

clutchski•10m ago
Mine is called “porthole”

https://github.com/clutchski/dotfiles/blob/main/home/bin/por...

I'm OK being left behind, thanks

https://shkspr.mobi/blog/2026/03/im-ok-being-left-behind-thanks/
100•coinfused•23m ago•37 comments

ArXiv Declares Independence from Cornell

https://www.science.org/content/article/arxiv-pioneering-preprint-server-declares-independence-co...
473•bookstore-romeo•9h ago•161 comments

Entso-E final report on Iberian 2025 blackout

https://www.entsoe.eu/publications/blackout/28-april-2025-iberian-blackout/
70•Rygian•2h ago•15 comments

Video Encoding and Decoding with Vulkan Compute Shaders in FFmpeg

https://www.khronos.org/blog/video-encoding-and-decoding-with-vulkan-compute-shaders-in-ffmpeg
43•y1n0•3d ago•10 comments

Flash-KMeans: Fast and Memory-Efficient Exact K-Means

https://arxiv.org/abs/2603.09229
84•matt_d•3d ago•4 comments

Schizophrenia study finds new biomarker, drug candidate to treat symptoms

https://news.northwestern.edu/stories/2026/03/schizophrenia-study-finds-new-biomarker-drug-candid...
7•gmays•43m ago•0 comments

The Soul of a Pedicab Driver

https://www.sheldonbrown.com/pedicab.html
72•haritha-j•4h ago•20 comments

Google details new 24-hour process to sideload unverified Android apps

https://arstechnica.com/gadgets/2026/03/google-details-new-24-hour-process-to-sideload-unverified...
987•0xedb•20h ago•1058 comments

Regex Blaster

https://mdp.github.io/regex-blaster/
15•mdp•2d ago•3 comments

Just Put It on a Map

https://progressandpoverty.substack.com/p/just-put-it-on-a-map
40•surprisetalk•4d ago•20 comments

Drawvg Filter for FFmpeg

https://ayosec.github.io/ffmpeg-drawvg/
114•nolta•2d ago•21 comments

Full Disclosure: A Third (and Fourth) Azure Sign-In Log Bypass Found

https://trustedsec.com/blog/full-disclosure-a-third-and-fourth-azure-sign-in-log-bypass-found
216•nyxgeek•12h ago•59 comments

Show HN: Sonar – A tiny CLI to see and kill whatever's running on localhost

https://github.com/RasKrebs/sonar
39•raskrebs•4h ago•20 comments

Too Much Color

https://www.keithcirkel.co.uk/too-much-color/
60•maguay•2d ago•28 comments

Drugwars for the TI-82/83/83 Calculators (2011)

https://gist.github.com/mattmanning/1002653/b7a1e88479a10eaae3bd5298b8b2c86e16fb4404
200•robotnikman•13h ago•61 comments

HP realizes that mandatory 15-minute support call wait times isn't good support

https://arstechnica.com/gadgets/2025/02/misguided-hp-customer-support-approach-included-forced-15...
17•felineflock•38m ago•2 comments

Building a Reader for the Smallest Hard Drive

https://www.willwhang.dev/Reading-MK4001MTD/
68•voctor•4d ago•19 comments

Push events into a running session with channels

https://code.claude.com/docs/en/channels
365•jasonjmcghee•13h ago•216 comments

Return of the Obra Dinn: spherical mapped dithering for a 1bpp first-person game

https://forums.tigsource.com/index.php?topic=40832.msg1363742#msg1363742
424•PaulHoule•3d ago•53 comments

Show HN: Three new Kitten TTS models – smallest less than 25MB

https://github.com/KittenML/KittenTTS
480•rohan_joshi•22h ago•164 comments

Cursor Composer 2 is just Kimi K2.5 with RL

https://twitter.com/fynnso/status/2034706304875602030
171•mirzap•4h ago•77 comments

How the Turner twins are mythbusting modern technical apparel

https://www.carryology.com/insights/how-the-turner-twins-are-mythbusting-modern-gear/
284•greedo•2d ago•146 comments

FSF statement on copyright infringement lawsuit Bartz v. Anthropic

https://www.fsf.org/blogs/licensing/2026-anthropic-settlement
157•m463•3d ago•72 comments

4Chan mocks £520k fine for UK online safety breaches

https://www.bbc.com/news/articles/c624330lg1ko
418•mosura•23h ago•761 comments

Cockpit is a web-based graphical interface for servers

https://github.com/cockpit-project/cockpit
292•modinfo•17h ago•166 comments

Astral to Join OpenAI

https://astral.sh/blog/openai
1405•ibraheemdev•1d ago•857 comments

Noq: n0's new QUIC implementation in Rust

https://www.iroh.computer/blog/noq-announcement
230•od0•19h ago•35 comments

Delphi 13.1 Released, with ARM64 support

https://blogs.embarcadero.com/announcing-the-availability-of-rad-studio-13-florence-update-1/
32•nopakos•2h ago•16 comments

France's aircraft carrier located in real time by Le Monde through fitness app

https://www.lemonde.fr/en/international/article/2026/03/20/stravaleaks-france-s-aircraft-carrier-...
13•MrDresden•1h ago•7 comments

Scaling Karpathy's Autoresearch: What Happens When the Agent Gets a GPU Cluster

https://blog.skypilot.co/scaling-autoresearch/
207•hopechong•21h ago•88 comments