sudo apt install net-tools
ubuntu@test-1:~$ sudo netstat -ntlp
激活Internet连接 (仅服务器)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 593/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 748/sshd: /usr/sbin
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 620/cupsd
tcp6 0 0 :::22 :::* LISTEN 748/sshd: /usr/sbin
tcp6 0 0 ::1:631 :::* LISTEN 620/cupsd
https://www.leftso.com/article/1008.html