Use netcat to scan open ports
Check if a port is open:
➜ nc -vz localhost 22
Connection to localhost port 22 [tcp/ssh] succeeded!
Scan many ports:
➜ nc -vz localhost 1-16384 2>&1 | grep succeed
Connection to localhost port 22 [tcp/ssh] succeeded!
Connection to localhost port 515 [tcp/printer] succeeded!
[...]