你也可以使用下面的命令检查特定的端口。
# nmap -sTU -O localhost | grep 123 -
123/udp open ntp
如何使用 Linux 命令 lsof 检查系统中的开放端口列表?
它向你显示系统上打开的文件列表以及打开它们的进程。还会向你显示与文件相关的其他信息。
# lsof -i -
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ntpd 895 ntp 16u IPv4 18481 0t0 UDP *:ntp ntpd 895 ntp 17u IPv6 18482 0t0 UDP *:ntp ntpd 895 ntp 18u IPv4 18487 0t0 UDP localhost:ntp ntpd 895 ntp 20u IPv4 23020 0t0 UDP CentOS7.2daygeek.com:ntp sshd 1388 root 3u IPv4 20065 0t0 TCP *:ssh (LISTEN) sshd 1388 root 4u IPv6 20067 0t0 TCP *:ssh (LISTEN) snmpd 1396 root 6u IPv4 22739 0t0 UDP *:snmp snmpd 1396 root 7u IPv4 22729 0t0 UDP *:40105 snmpd 1396 root 8u IPv4 22730 0t0 UDP *:50656 snmpd 1396 root 9u IPv4 22731 0t0 UDP *:pammratc snmpd 1396 root 10u IPv4 22732 0t0 UDP *:30105 snmpd 1396 root 11u IPv4 22733 0t0 UDP *:40764 snmpd 1396 root 12u IPv4 22734 0t0 UDP *:53390 snmpd 1396 root 13u IPv4 22735 0t0 UDP *:28265 snmpd 1396 root 14u IPv4 22736 0t0 UDP *:11584 snmpd 1396 root 15u IPv4 22737 0t0 UDP *:39136 snmpd 1396 root 16u IPv4 22738 0t0 UDP *:56130 snmpd 1396 root 17u IPv4 22740 0t0 TCP localhost:smux (LISTEN) httpd 1398 root 3u IPv4 20337 0t0 TCP *:http (LISTEN) master 2038 root 13u IPv4 21638 0t0 TCP *:smtp (LISTEN) master 2038 root 14u IPv6 21639 0t0 TCP *:smtp (LISTEN) sshd 9052 root 3u IPv4 1419955 0t0 TCP CentOS7.2daygeek.com:ssh->Ubuntu18-04.2daygeek.com:11408 (ESTABLISHED) httpd 13371 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13372 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13373 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13374 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13375 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN)
你也可以使用下面的命令检查特定的端口。
# lsof -i:80 -
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 1398 root 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13371 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13372 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13373 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13374 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13375 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN)
(编辑:ASP站长网)
|