Coffee Port

Coffee Port vs lsof and netstat

lsof answers “what is on this port right now”. It cannot answer “what is this port for”, because when nothing is running there is nothing for it to see.

Shows only what is listening now

What it remembers

Nothing. `lsof -i :4000` reads the kernel's open-file table, so a port with nothing bound to it is indistinguishable from a port you have never used. That is not a shortcoming — it is what the tool is for.

Sources: lsof(8) manual page, ss(8), the modern netstat. Checked .

What Coffee Port cannot do

It cannot see what is running. A web page has no way to list the sockets on your machine, and the way to get one — a daemon on localhost for the browser to talk to — would mean opening up the policy that stops a compromised page sending your decrypted ledger somewhere else. That is not a trade worth making for a list of process ids you can already get in a second.

So these are not rivals. lsof and netstat answers what is on 3000 right now; this answers what 3000 is for. Most people who want the second one already have the first.

Point by point

lsof and netstat compared with Coffee Port, point by point
Point of comparisonlsof and netstatCoffee Port
What is listening right nowEverything, and immediately. `lsof -i :4000` is the ground truth about the machine, which is why the rest of this table is not an argument that you should stop using it.Nothing. A web page cannot see what is bound to a port, and this one does not pretend to — pair it with any of the tools on this page for that half.
What it showsEvery socket open right now, with the process id, the command and the user.Every port you have claimed, running or not.
A port nothing is bound toInvisible. There is no row for it.A ledger. A port stays in it whether or not anything is bound to it, so 4012 still says which project claimed it and why after three months of not being run.
Choosing a new portYours to pick, and yours to remember.Hands out the next free number by rule — 40xx for personal things, 41xx for client work, or whatever you write — and says which rule chose it.
Ports that will waste an afternoonNot its job. It will happily show you a process bound to 6667, which no browser will open.Refuses the ephemeral range and the ports Chrome and Firefox block, and warns about 5432, 5000 and the other crowded ones — with the reason.
CostFree, and already installed.Free while it is in invite-only beta.
Where it runsA terminal, on the machine in question.Any modern browser

Which to use

Use lsof and netstat when

  • You need the process id, now, so you can kill it.
  • You are on a server over SSH, where a browser tab is not an option.
  • You want to see every socket, not just the ones you decided to care about.
  • You would rather not have another thing to keep up to date — a fair objection, and the honest cost of any ledger.

Use Coffee Port when

  • You have more than a handful of projects and cannot remember which one owns 4012.
  • You want a new port chosen for you, from a range you decided, rather than picked and hoped for.
  • You want the answer on the days the project is not running, which is most days.
  • You want a record that outlives the process — including the ports you have retired and do not want claimed again by accident.

Questions

How do I see what is running on port 3000?
On macOS or Linux, `lsof -i :4000` lists the process listening on it, or `sudo lsof -i :4000` if it belongs to another user. `ss -ltnp | grep :4000` does the same on modern Linux. On Windows, `netstat -ano | findstr :4000` gives you the process id for Task Manager.
Does lsof remember which project a port belongs to?
No. lsof reads the kernel's table of open files, so it can only see ports something is bound to at that moment. A port your project uses on Tuesdays does not exist to lsof on a Wednesday.
Do I still need lsof if I keep a port ledger?
Yes, and they answer different questions. The ledger says 4012 belongs to the invoicing API; lsof says which process is on it right now and whether it is the one you expected.