查看本机端口是否开启:
lsof -i :端口号
1、telnet
[root@localhost ~]# telnet 172.25.254.62 80
Trying 172.25.254.62...
Connected to 172.25.254.62. ##出现词句表示80端口已开启
Escape character is '^]'.
^C
Connection closed by foreign host.
由于执行改命令的时候不会自动终止,所以在写脚本的时候常常用以下命令:
[root@localhost ~]# echo -e "\n" |telnet 172.25.254.62 80 |grep Connected ##echo在这里起到终止该命令的作用
Connection closed by foreign host.
Connected to 172.25.254.62. ##单单只过滤出这一句即可
2、nmap
[root@localhost ~]# nmap 172.25.254.62 -p 80 |grep open
80/tcp open http
## -p 后边跟端口号
3.nc
本人没有实验成功,执行nc命令之后就会卡着