The BSD sockstat(1) command
SoftwareIn today’s installment of things you already know, unless you don’t, you can use sockstat(1) on the BSDs to list open sockets.
From the manpage(1), you can issue this command to show IPv4 sockets listening on port 22 using protocol TCP:
$ sockstat -4 -l -P tcp -p 22
I can’t tell you how many times this has saved me during a late-night troubleshooting session, when a service claims to be up but isn’t.