vs code sidebar that shows every dev server currently listening on your machine, across every workspace, with the process behind each port and a one-click open/kill/copy.
on a normal day i have:
- next on 3000
- some api on 8080
- postgres on 5432
- redis on 6379
- another project still running from yesterday on 5173
- something on 4000 that i don't remember starting
the built-in "ports" panel in vs code only shows what the current workspace is forwarding. docker desktop shows containers, not dev servers. nothing shows the whole picture at once. localhost-map is that view.
- linux: reads
/proc/net/tcpand/proc/*/fd/*to map listening sockets back to pids without shelling out. - macos:
lsof -iTCP -sTCP:LISTEN. - windows:
netstat -anoplustasklistfor process names. - when the process is owned by another user (docker-proxy, system postgres,
etc.), it falls back to
docker psto at least show the container name.
this means root-owned processes usually show as docker: <container> rather
than "unknown". there's no good way to get their actual pid without running
vs code as root, and i'd rather not do that.
install the vsix:
code --install-extension localhost-map-0.1.0.vsix
click the globe icon in the activity bar. the panel auto-refreshes every
4 seconds. click a row to open http://localhost:<port>. inline buttons
let you copy the url or kill the pid.
localhostMap.refreshIntervalMs(default4000): set0to disable auto-refresh.localhostMap.minPort(default1024): hide privileged ports.localhostMap.maxPort(default65535).localhostMap.ignoreProcesses(default: chrome, firefox, code, cursor, slack, spotify): substring match on command name.
git clone https://github.com/wanderer-npm/localhost-map
cd localhost-map
npm install
npm run compile
npx vsce package
- killing a process kills it cleanly with sigterm, then sigkill 1.5s later if it's still alive. it will not warn you twice.
- the docker enrichment only runs if the
dockercli is on your path. without docker it just shows blank process info for root-owned services. - windows testing has been light so far. works with docker desktop. file an issue if netstat output is weird on your setup.
mit.