Using nc (netcat) instead of telnet

A commonly used command in Linux is telnet, used to check if a connection can be established to another device. For example:

telnet <ip/host> <port>

However, when this fails, a decent error message is missing. The only thing the user can do is use [ Ctrl ] + [ C ] to abort the command. Instead of teltnet, it's better to use nc, which is a modern replacement and also has a built-in option for connection timeouts. Using nc is considered much cleaner/better than using telnet for connectivity checks. For example:

nc -vz -w 5 <ip/host> <port>

Examples, comparing the output from telnet to nc/netcat:

Using telnet
Using nc/netcat
telnet concera.com 80

image.png

nc -vz -w 5 concera.com 80

image.png

telnet concera.com 800

image.png

nc -vz -w 5 concera.com 800

image.png

telnet 192.168.200.123 443

image.png

nc -vz -w 5 192.168.200.123 800

image.png



References:

Revision #2
Created 2026-04-08 12:36:04 UTC by ADMIN Stefan
Updated 2026-04-08 13:07:21 UTC by ADMIN Stefan