nc命令获取远端端口状态
nc去获取对端端口的状态,-z表示只展示状态,-v输出显示,-w1表示1秒的超时时间
[root@localhost home]# nc -w1 -v -z www.baidu.com 8089
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connection to 180.101.49.11 failed: Connection timed out.
Ncat: Trying next address...
Ncat: Connection timed out.
[root@localhost home]# nc -w1 -v -z www.baidu.com 80
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 180.101.49.12:80.
Ncat: 0 bytes sent, 0 bytes received in 0.02 seconds.
[root@localhost home]#