Julia Evans on Nostr: I think I finally figured out how to get a list of every port that any program is ...
I think I finally figured out how to get a list of every port that any program is listening on, on a Mac?
sudo lsof -iTCP -sTCP:LISTEN -iUDP -n -P
I kept seeing the advice to use `sudo lsof -i -P` but when I run that command it prints some stuff out and then hangs forever, which doesn't feel good.
Also on Linux I'd use netstat for this but it seems like BSD netstat is extremely different from GNU netstat and maybe can't do this at all?
Published at
2024-06-17 12:53:39Event JSON
{
"id": "09a851bcfa0d2c0c7a2cba87f84991c960ec60fedc93f97f11a53a27d1751528",
"pubkey": "26cad6f140bf86de9c26b7c15419cab1aebdd7086358d26aa2d750e21cf3bf2e",
"created_at": 1718628819,
"kind": 1,
"tags": [
[
"proxy",
"https://social.jvns.ca/users/b0rk/statuses/112632058299461831",
"activitypub"
]
],
"content": "I think I finally figured out how to get a list of every port that any program is listening on, on a Mac?\n\nsudo lsof -iTCP -sTCP:LISTEN -iUDP -n -P\n\nI kept seeing the advice to use `sudo lsof -i -P` but when I run that command it prints some stuff out and then hangs forever, which doesn't feel good.\n\nAlso on Linux I'd use netstat for this but it seems like BSD netstat is extremely different from GNU netstat and maybe can't do this at all?",
"sig": "97a0d19549de0d18b3c1d688eca2c822e563d3876ccc47c5f8e40f883583b406bf2237cbf5fe1f4c33aa002ac84de41712d8397186bdec84cd2b0afc52ebaad9"
}