lsof -i -P; # list all open ports and listening services/programs

COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rpcbind     531     root    6u  IPv4  13740      0t0  UDP *:111 
rpcbind     531     root    7u  IPv4   9761      0t0  UDP *:704 
rpcbind     531     root    8u  IPv4   9762      0t0  TCP *:111 (LISTEN)
rpcbind     531     root    9u  IPv6   9763      0t0  UDP *:111 
rpcbind     531     root   10u  IPv6   9764      0t0  UDP *:704 
rpcbind     531     root   11u  IPv6   9765      0t0  TCP *:111 (LISTEN)
rpc.statd   552    statd    5u  IPv4  12144      0t0  UDP localhost:728 
rpc.statd   552    statd    8u  IPv4  12150      0t0  UDP *:51481 
rpc.statd   552    statd    9u  IPv4  12152      0t0  TCP *:43769 (LISTEN)
rpc.statd   552    statd   10u  IPv6  12154      0t0  UDP *:50486 
rpc.statd   552    statd   11u  IPv6  12156      0t0  TCP *:33369 (LISTEN)
sshd        655     root    3u  IPv4  17060      0t0  TCP *:22 (LISTEN)
sshd        655     root    4u  IPv6  17062      0t0  TCP *:22 (LISTEN)
avahi-dae   666    avahi   12u  IPv4  14482      0t0  UDP *:5353 
avahi-dae   666    avahi   13u  IPv6  14483      0t0  UDP *:5353 
avahi-dae   666    avahi   14u  IPv4  14484      0t0  UDP *:53985 
avahi-dae   666    avahi   15u  IPv6  14485      0t0  UDP *:52129 
ntpd        687      ntp   16u  IPv4  14448      0t0  UDP *:123 
ntpd        687      ntp   17u  IPv6  14456      0t0  UDP *:123 
ntpd        687      ntp   18u  IPv4   9944      0t0  UDP localhost:123 
ntpd        687      ntp   19u  IPv6   9945      0t0  UDP localhost:123 
cupsd       711     root   10u  IPv6  14876      0t0  TCP localhost:631 (LISTEN)
cupsd       711     root   11u  IPv4  14877      0t0  TCP localhost:631 (LISTEN)
cups-brow   713     root    5u  IPv6  13231      0t0  TCP localhost:60019->localhost:631 (CLOSE_WAIT)
cups-brow   713     root    7u  IPv4  10197      0t0  UDP *:631 
...
admin