If you want to check if a Port on a remote server is open or closed, you can use
Check Single Port
You need to provide the parameter
-v, otherwise you will not get output, even if the connection was successful.
[tux@server]$ nc -v <servername or ip> <port> Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to 192.168.178.1:<port>.
If you provide Parameter
-z you will check to port without establishing a connection.
Check Port Range
You can also scan a range of ports like so
# Scan ports 1 to 100 [tux@server]$ nc -v <servername or ip> 1-100
If you only want the successful connections, you can filter the output with
[tux@server]$ nc -v <servername> 1-100 | grep succeeded