12 comments

  • mfkrause4 minutes ago
    I always find myself going through my zsh history for `lsof`. Will definitely check this out, seems interesting (even though I'm generally reluctant of installing third-party tools for such jobs).
    • raskrebs0 minutes ago
      I get that, i also often install some and forgot about them. But i felt that there was a big gap in managing multiple services running on localhost. It's pretty lightweight if that helps
  • chwzr28 minutes ago
    i have this in my .zshrc which provides same functionality:<p><pre><code> 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 &quot;find and kill processes listening on ports. Usage: lk [pattern]&quot; return 1 fi if [ -z &quot;$output&quot; ]; then echo &quot;No listening processes found.&quot; return 0 fi # Show header + results echo &quot;$(sudo lsof -iTCP -sTCP:LISTEN -n -P | head -1)&quot; echo &quot;$output&quot; echo &quot;&quot; # Extract unique PIDs (skip the header row if no grep was applied) local pids=($(echo &quot;$output&quot; | awk &#x27;{print $2}&#x27; | grep -E &#x27;^[0-9]+$&#x27; | sort -u)) if [ ${#pids[@]} -eq 0 ]; then echo &quot;No PIDs found.&quot; return 0 fi echo &quot;PIDs to kill: ${pids[*]}&quot; echo -n &quot;Kill these ${#pids[@]} process(es)? [y&#x2F;N] &quot; read -r confirm if [[ &quot;$confirm&quot; =~ ^[Yy]$ ]]; then for pid in &quot;${pids[@]}&quot;; do echo &quot;Killing PID $pid...&quot; sudo kill -9 $pid done echo &quot;Done.&quot; else echo &quot;Aborted.&quot; fi }</code></pre>
    • raskrebs9 minutes ago
      I have added quite a lot of functionality beyond listing and killing ports. Please check out the readme, it may convince you to try it out.
      • fionic3 minutes ago
        Its funny bc the title suggests a tool for listing and killing
  • clutchski20 minutes ago
    Mine is called “porthole”<p><a href="https:&#x2F;&#x2F;github.com&#x2F;clutchski&#x2F;dotfiles&#x2F;blob&#x2F;main&#x2F;home&#x2F;bin&#x2F;porthole" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clutchski&#x2F;dotfiles&#x2F;blob&#x2F;main&#x2F;home&#x2F;bin&#x2F;por...</a>
    • raskrebs6 minutes ago
      Any features you are missing or ideas for the use case?
  • klaushardt1 hour 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.<p><pre><code> 3000 wud (getwud&#x2F;wud:latest) wud getwud&#x2F;wud:latest 3000 http:&#x2F;&#x2F;localhost:3000 3001 dockhand (fnsys&#x2F;dockhand:latest) dockhand fnsys&#x2F;dockhand:latest 3000 http:&#x2F;&#x2F;localhost:3001</code></pre>
    • raskrebs14 minutes ago
      Good point. Could you add an issue, then i&#x27;ll have a chance to look into it :)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;RasKrebs&#x2F;sonar&#x2F;issues" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;RasKrebs&#x2F;sonar&#x2F;issues</a>
  • pdimitar22 minutes ago
    I am absolutely installing this and starting to use it daily!<p>For the even less patient there&#x27;s also this (not mine): <a href="https:&#x2F;&#x2F;github.com&#x2F;jkfran&#x2F;killport" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jkfran&#x2F;killport</a>
    • raskrebs11 minutes ago
      Glad to hear! Please join the party and post any issues you have.
  • raskrebs4 hours ago
    I always have a bunch of local projects running, particularly during the weekend where I&#x27;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.<p>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.<p>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&#x27;s really useful when you have multiple agents running, but it&#x27;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.<p>Open for contributions, ideas and feedback.
    • embedding-shape1 hour ago
      &gt; I’ve already been approached by a few agent orchestration tools that have been struggling with the same thing<p>Wow, this says more about the agent orchestration tool ecosystem than what you might think, that they&#x27;re unable to kill child processes they themselves spawn makes it seem like they have zero clue about what they&#x27;re doing.<p>Probably why my impression always end up with &quot;Wow, what a vibe-coded mess&quot; when I look through the source of all these harnesses, they don&#x27;t seem engineered at all.
    • pluc1 hour ago
      Have a look at Evan Hahn&#x27;s murder util: <a href="https:&#x2F;&#x2F;codeberg.org&#x2F;EvanHahn&#x2F;dotfiles&#x2F;src&#x2F;commit&#x2F;843b9ee13d949d346a4a73ccee2a99351aed285b&#x2F;home&#x2F;bin&#x2F;bin&#x2F;murder" rel="nofollow">https:&#x2F;&#x2F;codeberg.org&#x2F;EvanHahn&#x2F;dotfiles&#x2F;src&#x2F;commit&#x2F;843b9ee13d...</a>
  • moezd47 minutes ago
    Sonar as in SonarQube? That&#x27;s an interesting choice for a name :)
    • beart22 minutes ago
      How about Sonar as in SOund Navigation And Ranging?
  • frankdenbow57 minutes ago
    love this, happens too often
    • raskrebs7 minutes ago
      Exactly, really hates it as well. Please post any issues you may have
  • Bradd3rs2 hours ago
    love this, i get tired of spamming lsof -i tcp:xxxx
    • Doublon1 hour ago
      The README made me realize I just needed a simple `alias local-tcp-listeners=&#x27;lsof -iTCP -sTCP:LISTEN&#x27;` in my `~&#x2F;.bash_aliases` :)
      • deadbabe1 hour ago
        Same, not sure why a whole cli app is needed.
        • raskrebs1 hour ago
          Developers are nitpicky, atleast i am and i know a lot of others that are as well. So don&#x27;t underestimate the value of a nice tool with good developer experience, one that&#x27;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) :)
        • paddim81 hour ago
          Because it gives more context. Quite obvious if you look at the readme...
      • tenpatteiru33 minutes ago
        [dead]
      • raskrebs1 hour ago
        True, but as i write their are workarounds, the problem is that they are unintuitive, difficult to remember and don&#x27;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.<p>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&#x27;s not just about listing running ports, but a tool for managing them.<p>But to each their own, that&#x27;s what&#x27;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&#x27;t suffice.
    • raskrebs2 hours 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&#x27;s a couple of open enhancement ideas as well. Feel free to add any or contribute.
  • olivercoleai7 minutes ago
    [dead]
  • takahitoyoneda33 minutes ago
    [dead]
  • Servant-of-Inos3 hours ago
    [dead]