So I’ve been operating FreeBSD servers for about a year now where I work. I’ve come to really like the sockstat command in FreeBSD
# sockstat -l -4
will list every ipv4 address listening in some port and which user the process that is listening to that port is.
In Linux I’ve usually done the same with
# netstat -taupen
netstat -taupen isn’t as ‘clean’ as sockstat in FreeBSD, but I see that
# netstat -tln
give me less info, and I think I’d prefer that one when I simply need to check which ports are in a LISTENING state ( and add -u to show udp as well )