nc -z hostname port Into this: cat /dev/null | nc hostname port You might also want to add in an option like -w 1s to avoid the long default timeout. There might be a cleaner combination of options that avoids the need for the /dev/null but I couldn’t figure out what.
https://stackoverflow.com/questions/38695594/nc-invalid-option-z

