<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arpit Sarang</title>
    <description>The latest articles on DEV Community by Arpit Sarang (@codemaverick143).</description>
    <link>https://dev.to/codemaverick143</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2706522%2F3c166cc2-67f0-43b1-9442-9274902dc9bc.jpeg</url>
      <title>DEV Community: Arpit Sarang</title>
      <link>https://dev.to/codemaverick143</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codemaverick143"/>
    <language>en</language>
    <item>
      <title>Why I Replaced lsof with a Rust-Based "Sniper" Button</title>
      <dc:creator>Arpit Sarang</dc:creator>
      <pubDate>Sat, 25 Apr 2026 14:34:19 +0000</pubDate>
      <link>https://dev.to/codemaverick143/why-i-replaced-lsof-with-a-rust-based-sniper-button-5874</link>
      <guid>https://dev.to/codemaverick143/why-i-replaced-lsof-with-a-rust-based-sniper-button-5874</guid>
      <description>&lt;p&gt;Every developer has a "favorite" annoying workflow. Mine was hunting down zombie processes that refused to release my local dev ports.&lt;/p&gt;

&lt;p&gt;If you've ever typed this into your terminal for the 5th time in an hour, you know the pain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsof &lt;span class="nt"&gt;-i&lt;/span&gt; :3000
&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-9&lt;/span&gt; &amp;lt;PID&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I decided to automate this friction away by building Recoil—a tactical system monitor for macOS that lets you "snipe" these processes directly from your system tray.&lt;/p&gt;

&lt;p&gt;The Goal: High Performance, Low Overhead&lt;br&gt;
When building a system utility that stays open all day, Electron was out of the question. I didn't want a 150MB helper app just to kill a process.&lt;/p&gt;

&lt;p&gt;I chose Tauri v2 because it allowed me to:&lt;/p&gt;

&lt;p&gt;Leverage the System Webview: Resulting in a ~5MB bundle.&lt;br&gt;
Use Rust for System Tasks: Directly interfacing with system APIs for telemetry and process management.&lt;br&gt;
React for UI: Keeping the interface modern and "tactical."&lt;br&gt;
Technical Deep Dive: The Rust Core&lt;br&gt;
In Recoil, we use Rust to handle the heavy lifting of scanning ports. Here’s a simplified look at how we interface with system commands to find those port-hogging PIDs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// A peek into the command logic&lt;/span&gt;
&lt;span class="nd"&gt;#[tauri::command]&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;get_active_ports&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Vec&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;PortInfo&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// We use a combination of sysinfo and lsof logic&lt;/span&gt;
    &lt;span class="c1"&gt;// to map ports to process names and IDs safely.&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;system&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new_all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="nf"&gt;.refresh_all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;// ... logic to filter and return active listeners&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By keeping the scanning logic in the Rust "backend" of the Tauri app, we ensure that the UI remains responsive even when the system is under heavy load.&lt;/p&gt;

&lt;p&gt;The Result: The "Sniper" Experience&lt;br&gt;
The core of Recoil is the Sniper Button. It's a visual way to reclaim your environment.&lt;/p&gt;

&lt;p&gt;Key Features:&lt;br&gt;
Live Port Monitoring: Automatically detects new listeners.&lt;br&gt;
Tactical Telemetry: Real-time CPU and Memory tracking.&lt;br&gt;
Minimal Footprint: Idles at negligible RAM usage compared to similar Electron-based monitors.&lt;br&gt;
Lessons Learned building with Tauri v2&lt;br&gt;
Tauri v2 is a huge step forward, especially with the improved plugin system. Implementing system tray support and window shadowing was significantly smoother than in v1. If you're coming from the web world and want to build "real" system tools, this is the stack to watch.&lt;/p&gt;

&lt;p&gt;Open Source &amp;amp; Feedback&lt;br&gt;
Recoil is open-source and I’m currently looking for contributors to help optimize it for Windows and Linux.&lt;/p&gt;

&lt;p&gt;Check out the repo: &lt;a href="https://github.com/CodeMaverick143/recoil" rel="noopener noreferrer"&gt;https://github.com/CodeMaverick143/recoil&lt;/a&gt; &lt;br&gt;
Live Site: &lt;a href="https://recoil.xplnhub.tech" rel="noopener noreferrer"&gt;https://recoil.xplnhub.tech&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd love to hear how you all handle port conflicts in your daily workflow. Are you still a kill -9 purist, or have you moved to GUI tools?&lt;/p&gt;

</description>
      <category>tauri</category>
      <category>rust</category>
      <category>devtool</category>
    </item>
  </channel>
</rss>
