Sockstat
From wikinotes
sockstat is a FreeBSD tool that lists open ports.
A clone has been written for linux.
Documentation
FreeBSD manpage https://www.freebsd.org/cgi/man.cgi?query=sockstat Debian manpage http://manpages.ubuntu.com/manpages/trusty/man1/sockstat.1.html
Install
# FreeBSD # (pre-installed with base) # Archlinux # see https://packages.debian.org/unstable/main/sockstat curl -#0 http://deb.debian.org/debian/pool/main/s/sockstat/sockstat_0.4.1.orig.tar.gz --output sockstat.tar.gz tar -xvf sockstat.tar.gz cd sockstat make sudo make install
Usage
sockstat -4 # USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS # root wireguard- 97588 13 udp4 *:51891 *:* # root sshd 75092 4 tcp4 *:22 *:* # websrv python2.7 63252 5 tcp4 127.0.0.1:8080 *:* # root syslogd 21271 6 udp4 *:514 *:*