Unix muscle memory for "who owns that port?" — native on Windows.
Windows-native Single binary Rust MIT
Install GitHub
note: who owns port 3000? cmd: lsof -i :3000 COMMAND PID PROTO LOCAL_ADDRESS FOREIGN_ADDRESS STATE node.exe 4312 TCP 0.0.0.0:3000 0.0.0.0:0 LISTEN node.exe 4312 TCP 127.0.0.1:3000 127.0.0.1:52114 ESTABLISHED delay[1200]: cmd: lsof -t -i :3000 4312 note: terse mode — pipe it straight into taskkill delay[1200]: cmd: lsof file C:\logs\app.log COMMAND PID node.exe 4312

Why

Your fingers type lsof -i :3000 on every machine — but on Windows the answer is a tour of netstat -ano, Task Manager, and Resource Monitor. This is a Windows-first lsof-style tool covering the workflows that map cleanly from Unix: which process owns a port, what TCP/UDP sockets are live, and which process is holding a file you can't delete.

The flags you already know

-i with tcp/udp, @host, and :port specs, -p PID filtering, -t terse PID-only output. -n and -P are accepted for lsof compatibility.

Native Windows APIs

IP Helper API for TCP/UDP socket ownership, QueryFullProcessImageNameW() for process metadata, and the Restart Manager for file-in-use ownership. No shelling out, no parsing netstat.

Who's holding that file?

lsof file C:\path\to\app.log asks the Windows Restart Manager which processes are currently using a file — the exact thing you need before a delete or rename fails.

Non-goals

Windows-only by design. It does not aim for full Unix lsof parity, system-wide open-handle enumeration, or file-descriptor-style output such as cwd, txt, mem, or numeric FD sets.

Install

Windows (Scoop)

scoop bucket add rocky https://github.com/i-rocky/scoop-bucket
scoop install lsof

Manual (GitHub Releases)

Download lsof-windows-x86_64-vX.Y.Z.zip from the latest release (with SHA256SUMS.txt), then place lsof.exe on your PATH.

Usage

There is no setup. Install, then:

CommandWhat it does
lsof -ilist all active TCP/UDP sockets with owning processes
lsof -i :3000who owns port 3000
lsof -i tcp:443TCP sockets on port 443
lsof -i udp@127.0.0.1:53UDP sockets bound to 127.0.0.1 on port 53
lsof -t -i :8080terse mode — print matching PIDs only (pipe-friendly)
lsof -p 1234,5678 -ifilter by a comma-separated PID list
lsof file C:\path\to\app.logshow processes currently using a file (Restart Manager)

Flags

FlagMeaning
-i [spec]select by socket spec; supports proto tcp/udp, host, and port — [tcp|udp][@host][:port]
-p <pids>filter by PID list (comma-separated)
-tterse mode (print PIDs only)
-naccepted for lsof compatibility (numeric hosts)
-Paccepted for lsof compatibility (numeric ports)
file <path>show processes currently using a file
-h, --helpdisplay help
-v, --versiondisplay version