The BSD sockstat(1) command

In 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.

Tagged: software bsd freebsd netbsd

Who wrote this?

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person.

This blog is powered by the excellent FreeBSD and OpenZFS. Also check out BSD Now.

You can buy me a coffee or send a comment if you found this post useful or entertaining. Cheers.