Filter the port number used by the service through the name of the service
# netstat-upnl|grep NTPD I This command is to filter out the UDP port number of the NTP service
DP 0 0 172.16.1.4:123 0.0.0.0:* 9591/ntpd
UDP 0 0 127.0.0.1:123 0.0.0.0:* 9591/ntpd
UDP 0 0 0.0.0.0:123 0.0.0.0:* 9591/ntpd
UDP 0 0 fe80::e61f:13ff:fe3:123:::* 9591/ntpd
UDP 0 0:: 1:123:::* 9591/ntpd
UDP 0 0::: 123:::* 9591/ntpd
-U (UDP) displays only UDP-related options
-T (TCP) displays only TCP-related options
-P Displays the program name that establishes the associated link
-N refuses to display aliases, showing all numbers converted to numbers.
-l list only service status in Listen (listening)
This article is from the "david0512" blog, make sure to keep this source http://gjr0512.blog.51cto.com/6518687/1728301
Filter the port number used by the service through the name of the service