Netstat
查看當前哪些端口在監(jiān)聽:netstat -ltnp
l – tells netstat to only show listening sockets.
t – tells it to display tcp connections.
n – instructs it show numerical addresses.
p – enables showing of the process ID and the process name.
grep -w – shows matching of exact string (:80).
$ netstat -ltnp|head -10
(No info could be read for "-p": geteuid()=1004 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
...
注意:如果看不到PID是因為權(quán)限不夠果善,換成root可以看到全部的PID.
查看端口占用:netstat -ano|grep 80
块攒;
查看所有的TCP連接端口:netstat -an -p
谎仲;
Label: 監(jiān)聽端口
驶社、網(wǎng)絡(luò)端口
砌烁、查看端口
秒梳、網(wǎng)絡(luò)檢測
梆砸、網(wǎng)絡(luò)請求狀態(tài)
哺哼、TCP連接狀態(tài)
telnet(Telnet)
The telnet command is used for interactive communication with another host using the TELNET protocol.
example
$ telnet 192.168.1.30 1521
Trying 192.168.1.30...
Connected to 192.168.85.55.
Escape character is '^]'.