linux远程端口查看

telnet常被用来检测是个远端端口是否通畅。

[root@oldboy ~]# telnet baidu.com 80
Trying 123.125.114.144...
Connected to baidu.com (123.125.114.144). #==>出现Connected表示连通了,说明百度的80端口开放的
Escape character is '^]'. #==>ctrl+]退出此地。
^]
telnet> quit
Connection closed.

如果写脚本通过telnet检查端口可以用下面的方法:

[root@oldboy ~]# echo -e "\n"|telnet baidu.com 80|grep Connected
Connection closed by foreign host.
Connected to baidu.com (123.125.114.144).

文章来源:http://blog.chinaunix.net/uid-26000296-id-4086980.html