Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/946fb4de0c7ab0156fcb5f9f6d36d93d to your computer and use it in GitHub Desktop.
Save ezhov-da/946fb4de0c7ab0156fcb5f9f6d36d93d to your computer and use it in GitHub Desktop.
Проверка доступности TCP
==> https://www.cyberciti.biz/faq/ping-test-a-specific-port-of-machine-ip-address-using-linux-unix/
## 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment