freebsd
[root@xen165v /usr/home/zengwenjie]# sockstat -l
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root sendmail 682 3 tcp4 127.0.0.1:25 *:*
root sshd 676 3 tcp6 *:22 *:*
root sshd 676 4 tcp4 *:22 *:*
root ntpd 645 20 udp4 *:123 *:*
root ntpd 645 21 udp6 *:123 *:*
root ntpd 645 22 udp4 192.168.100.136:123 *:*
root ntpd 645 23 udp6 fe80:3::1:123 *:*
root ntpd 645 24 udp6 ::1:123 *:*
root ntpd 645 25 udp4 127.0.0.1:123 *:*
root perl5.8.9 644 8 tcp4 *:8006 *:*
root snmpd 599 8 udp4 *:161 *:*
root syslogd 538 4 dgram /var/run/log
root syslogd 538 5 dgram /var/run/logpriv
root syslogd 538 6 udp6 *:514 *:*
root syslogd 538 7 udp4 *:514 *:*
root devd 477 4 stream /var/run/devd.pipe
[root@xen165v /usr/home/zengwenjie]# !so
sockstat -l
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root sendmail 682 3 tcp4 127.0.0.1:25 *:*
root sshd 676 3 tcp6 *:22 *:*
root sshd 676 4 tcp4 *:22 *:*
root ntpd 645 20 udp4 *:123 *:*
root ntpd 645 21 udp6 *:123 *:*
root ntpd 645 22 udp4 192.168.100.136:123 *:*
root ntpd 645 23 udp6 fe80:3::1:123 *:*
root ntpd 645 24 udp6 ::1:123 *:*
root ntpd 645 25 udp4 127.0.0.1:123 *:*
root perl5.8.9 644 8 tcp4 *:8006 *:*
root snmpd 599 8 udp4 *:161 *:*
root syslogd 538 4 dgram /var/run/log
root syslogd 538 5 dgram /var/run/logpriv
root syslogd 538 6 udp6 *:514 *:*
root syslogd 538 7 udp4 *:514 *:*
root devd 477 4 stream /var/run/devd.pipe
[root@xen165v /usr/home/zengwenjie]#
linux
netstat -l