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.
-i with tcp/udp, @host, and :port specs, -p PID filtering, -t terse PID-only output. -n and -P are accepted for lsof compatibility.
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.
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.
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.
scoop bucket add rocky https://github.com/i-rocky/scoop-bucket scoop install lsof
Download lsof-windows-x86_64-vX.Y.Z.zip from the
latest release
(with SHA256SUMS.txt), then place lsof.exe on your PATH.
There is no setup. Install, then:
| Command | What it does |
|---|---|
lsof -i | list all active TCP/UDP sockets with owning processes |
lsof -i :3000 | who owns port 3000 |
lsof -i tcp:443 | TCP sockets on port 443 |
lsof -i udp@127.0.0.1:53 | UDP sockets bound to 127.0.0.1 on port 53 |
lsof -t -i :8080 | terse mode — print matching PIDs only (pipe-friendly) |
lsof -p 1234,5678 -i | filter by a comma-separated PID list |
lsof file C:\path\to\app.log | show processes currently using a file (Restart Manager) |
| Flag | Meaning |
|---|---|
-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) |
-t | terse mode (print PIDs only) |
-n | accepted for lsof compatibility (numeric hosts) |
-P | accepted for lsof compatibility (numeric ports) |
file <path> | show processes currently using a file |
-h, --help | display help |
-v, --version | display version |