2008年3月6日 星期四

Use netstat to show the current binding port of each daemon

If we want to know which port is binding on which program, we can use the netstat. Use the -p parameter to show the binding program name.
# netstat -anp | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 2213/hpiod
tcp 0 0 0.0.0.0:966 0.0.0.0:* LISTEN 2056/rpc.statd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2230/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2264/sendmail: acce
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 2218/python
tcp 0 0 :::111 :::* LISTEN 2022/rpcbind
tcp 0 0 :::22 :::* LISTEN 2244/sshd
tcp 0 52 ::ffff:192.168.180.57:22 ::ffff:192.168.180.56:4143 ESTABLISHED 32126/sshd: vincent
udp 0 0 0.0.0.0:32768 0.0.0.0:* 2456/avahi-daemon:
udp 0 0 0.0.0.0:960 0.0.0.0:* 2056/rpc.statd
udp 0 0 0.0.0.0:963 0.0.0.0:* 2056/rpc.statd
udp 0 0 0.0.0.0:5353 0.0.0.0:* 2456/avahi-daemon:
udp 0 0 0.0.0.0:631 0.0.0.0:* 2230/cupsd
udp 0 0 :::32769 :::* 2456/avahi-daemon:
udp 0 0 :::925 :::* 2022/rpcbind
udp 0 0 :::5353 :::* 2456/avahi-daemon:
udp 0 0 :::111 :::* 2022/rpcbind

沒有留言: