📌  相关文章
📜  linux bash 测试与主机和端口的连接 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:12.148000             🧑  作者: Mango

代码示例1
## check for tcp port ##
## need bash shell ##
(echo >/dev/tcp/{host}/{port}) &>/dev/null && echo "open" || echo "close"
(echo >/dev/udp/{host}/{port}) &>/dev/null && echo "open" || echo "close"
(echo >/dev/tcp/www.cyberciti.biz/22) &>/dev/null && echo "Open 22" || echo "Close 22"
(echo >/dev/tcp/www.cyberciti.biz/443) &>/dev/null && echo "Open 443" || echo "Close 443"