命令:netstat -a
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost.localdomain:2208 *:* LISTEN
tcp 0 0 *:836 *:* LISTEN
tcp 0 0 *:mysql *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 localhost.localdomain:2208 *:* LISTEN
tcp 0 0 *:836 *:* LISTEN
tcp 0 0 *:mysql *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
******************************************************************************************
协议(Proto):TCP,指是传输层通讯协议
recv_q:得到包
send_q:发送包
local address:本地地址
远程机器名(Foreign Address):
ESTABLISHED:已建立联机的联机情况。
TIME_WAIT:该联机在目前已经是等待的状态。
---------------------------------------------------------------------------------------------------------
命令:netstat -n
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 ::ffff:192.168.1.239:22 ::ffff:192.168.1.130:2590 ESTABLISHED
tcp 0 0 ::ffff:192.168.1.239:22 ::ffff:192.168.1.17:1667 ESTABLISHED
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 ::ffff:192.168.1.239:22 ::ffff:192.168.1.130:2590 ESTABLISHED
tcp 0 0 ::ffff:192.168.1.239:22 ::ffff:192.168.1.17:1667 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 18 [ ] DGRAM 7445 /dev/log
unix 2 [ ] DGRAM 2728 @/org/kernel/udev/udevd
unix 2 [ ] DGRAM 8289 @/org/freedesktop/hal/udev_event
unix 2 [ ] DGRAM 3089970
unix 3 [ ] STREAM CONNECTED 3089723 /tmp/mysql.sock
unix 3 [ ] STREAM CONNECTED 3089722
unix 2 [ ] DGRAM 3089678
unix 3 [ ] STREAM CONNECTED 1009861 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 1009860
Proto RefCnt Flags Type State I-Node Path
unix 18 [ ] DGRAM 7445 /dev/log
unix 2 [ ] DGRAM 2728 @/org/kernel/udev/udevd
unix 2 [ ] DGRAM 8289 @/org/freedesktop/hal/udev_event
unix 2 [ ] DGRAM 3089970
unix 3 [ ] STREAM CONNECTED 3089723 /tmp/mysql.sock
unix 3 [ ] STREAM CONNECTED 3089722
unix 2 [ ] DGRAM 3089678
unix 3 [ ] STREAM CONNECTED 1009861 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 1009860
1. -n 显示用数字化主机名,即IP地址,而不是compute_name【eagle】
2. -n 只显示TCP连接
-a和-n的区别:-n是数字化显示 例如: -a是localhost -n是127.0.0.1