You can use traditional netstat / lsof command to lists open Internet or UNIX domain sockets on FreeBSD. FreeBSD comes with a simple and easy to use command called sockstat.
The -4 option only displays IPv4 sockets.
The -6 option only displays IPv6 sockets.
The -c option only displays connected sockets.
The -l option only displays listening sockets (open port).
For example, display IPv4 related open ports, enter:
# sockstat -4 -l
Output:
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root sendmail 653 3 tcp4 127.0.0.1:25 *:* root sshd 647 3 tcp4 10.20.110.2:22 *:* root ntpd 616 4 udp4 *:123 *:*
Here the equivalent of netstat:
$ netstat -nat | grep LISTEN
For information read sockstat command man page:
$ man sockstat
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins

- My 10 UNIX Command Line Mistakes
- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
Facebook it - Tweet it - Print it -
We're here to help you make the most of sysadmin work. So, subscribe!

