<?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: Mark Marosi</title>
    <description>The latest articles on DEV Community by Mark Marosi (@mapika).</description>
    <link>https://dev.to/mapika</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%2F3860849%2Fb01d91ee-080a-47b3-bf4b-256521e43efe.png</url>
      <title>DEV Community: Mark Marosi</title>
      <link>https://dev.to/mapika</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mapika"/>
    <language>en</language>
    <item>
      <title>I replaced lsof, ss, and netstat with a single Rust binary</title>
      <dc:creator>Mark Marosi</dc:creator>
      <pubDate>Sat, 04 Apr 2026 10:51:53 +0000</pubDate>
      <link>https://dev.to/mapika/i-replaced-lsof-ss-and-netstat-with-a-single-rust-binary-36i</link>
      <guid>https://dev.to/mapika/i-replaced-lsof-ss-and-netstat-with-a-single-rust-binary-36i</guid>
      <description>&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Every developer has been here: something is hogging port 3000 and you need to find out what.&lt;/p&gt;

&lt;p&gt;On Linux you try &lt;code&gt;ss -tlnp | grep 3000&lt;/code&gt;. On macOS it's &lt;code&gt;lsof -i :3000&lt;/code&gt;. On Windows... good luck. Each gives different output, different flags, and none of them tell you how long the process has been running, how much memory it's eating, or whether it's a Docker container.&lt;/p&gt;

&lt;p&gt;I got tired of this. So I built &lt;a href="https://github.com/Mapika/portview" rel="noopener noreferrer"&gt;portview&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  One command, everything you need
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;portview
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Every listening port, the process behind it, PID, user, uptime, memory usage, and the full command -- in a colored table. Cross-platform. ~1.3 MB single binary. Zero runtime dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PORT  PROTO  PID    USER   PROCESS   UPTIME   MEM     COMMAND
3000  TCP    48291  mark   node      3h 12m   248 MB  next dev
5432  TCP    1203   pg     postgres  14d 2h   38 MB   /usr/lib/postgresql/16/bin/postgres
6379  TCP    1198   redis  redis     14d 2h   12 MB   redis-server *:6379
8080  TCP    51002  mark   python3   22m      45 MB   uvicorn main:app --port 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No parsing &lt;code&gt;lsof&lt;/code&gt; output through &lt;code&gt;awk&lt;/code&gt;. No remembering whether it's &lt;code&gt;-tlnp&lt;/code&gt; or &lt;code&gt;-tulpn&lt;/code&gt;. Just &lt;code&gt;portview&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  But I didn't stop there
&lt;/h2&gt;

&lt;p&gt;A port viewer that just lists ports isn't worth writing about. Here's what makes portview different:&lt;/p&gt;

&lt;h3&gt;
  
  
  Interactive TUI with tree view
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;portview watch&lt;/code&gt; opens a live-refreshing TUI. Navigate with &lt;code&gt;j&lt;/code&gt;/&lt;code&gt;k&lt;/code&gt;, press &lt;code&gt;Enter&lt;/code&gt; to inspect a port in detail (full command, working directory, child processes, open connections), press &lt;code&gt;d&lt;/code&gt; to kill it.&lt;/p&gt;

&lt;p&gt;Press &lt;code&gt;t&lt;/code&gt; to toggle &lt;strong&gt;tree view&lt;/strong&gt; -- it groups child processes under their parents so you can see which workers belong to which master process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PROCESS
node
├── node (worker)
├── node (worker)
└── node (worker)
postgres
└── postgres: autovacuum
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Docker as a first-class citizen
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;portview watch --docker&lt;/code&gt; shows Docker containers as rows in the table. No more running &lt;code&gt;docker ps&lt;/code&gt; in a separate terminal and cross-referencing ports. Press &lt;code&gt;d&lt;/code&gt; on a container row to Stop, Restart, or tail Logs.&lt;/p&gt;

&lt;h3&gt;
  
  
  portview doctor
&lt;/h3&gt;

&lt;p&gt;This is my favorite feature. &lt;code&gt;portview doctor&lt;/code&gt; runs five diagnostic checks on your ports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;portview doctor
&lt;span class="go"&gt;  ✓ No port conflicts
  ✗ postgres is listening on 0.0.0.0:5432 -- consider binding to 127.0.0.1
  ✓ No Docker-host conflicts
  ✓ No stale connections
  ✓ No high-resource listeners
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It catches: port conflicts (two processes fighting over the same port), databases exposed on all interfaces, Docker port collisions with host processes, TIME_WAIT/CLOSE_WAIT pileups, and memory hogs. Use &lt;code&gt;portview doctor --json&lt;/code&gt; with exit code 1 on errors for CI.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSH remote mode
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;portview ssh user@server          &lt;span class="c"&gt;# scan remote ports&lt;/span&gt;
portview ssh user@server watch    &lt;span class="c"&gt;# full remote TUI&lt;/span&gt;
portview ssh user@server doctor   &lt;span class="c"&gt;# remote diagnostics&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It shells out to your system &lt;code&gt;ssh&lt;/code&gt; binary (inherits your config, keys, ProxyJump, everything), runs &lt;code&gt;portview --json&lt;/code&gt; on the remote host, and renders the output locally. Kill actions in the remote TUI are forwarded over SSH. No agents, no daemons, no new ports to open.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;No shelling out to &lt;code&gt;lsof&lt;/code&gt; or &lt;code&gt;ss&lt;/code&gt;. portview reads directly from the OS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linux&lt;/strong&gt;: Parses &lt;code&gt;/proc/net/tcp&lt;/code&gt;, maps inodes to PIDs via &lt;code&gt;/proc/*/fd/&lt;/code&gt;, reads process metadata from &lt;code&gt;/proc/&amp;lt;pid&amp;gt;/status&lt;/code&gt; and &lt;code&gt;/proc/&amp;lt;pid&amp;gt;/stat&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS&lt;/strong&gt;: Uses &lt;code&gt;libproc&lt;/code&gt; FFI (&lt;code&gt;proc_listpids&lt;/code&gt;, &lt;code&gt;proc_pidfdinfo&lt;/code&gt;, &lt;code&gt;proc_pidinfo&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: Uses &lt;code&gt;iphlpapi&lt;/code&gt; (&lt;code&gt;GetExtendedTcpTable&lt;/code&gt;) and &lt;code&gt;kernel32&lt;/code&gt; (&lt;code&gt;CreateToolhelp32Snapshot&lt;/code&gt;, &lt;code&gt;GetProcessTimes&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is why it's fast -- there's no subprocess overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/mapika/portview/main/install.sh | sh   &lt;span class="c"&gt;# Linux/macOS&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;mapika/tap/portview                                                      &lt;span class="c"&gt;# Homebrew&lt;/span&gt;
cargo &lt;span class="nb"&gt;install &lt;/span&gt;portview                                                                &lt;span class="c"&gt;# Cargo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or grab a binary from the &lt;a href="https://github.com/Mapika/portview/releases" rel="noopener noreferrer"&gt;releases page&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;The codebase is ~6K lines of Rust. MIT licensed. Contributions welcome.&lt;/p&gt;

&lt;p&gt;If you've ever been frustrated by &lt;code&gt;lsof&lt;/code&gt;, give it a try and let me know what you think: &lt;a href="https://github.com/Mapika/portview" rel="noopener noreferrer"&gt;github.com/Mapika/portview&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>cli</category>
      <category>linux</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
