Answers for "linux bash test connection to host and port"

0

linux bash test connection to host and port

## 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"
Posted by: Guest on August-10-2021

Code answers related to "linux bash test connection to host and port"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language