Using netcat

This is a quick guide to using the netcat command.


You can find all my latest posts on medium.

Netcat is a really handy tool to check whether a certain port is open on a box, here’s an example on how to do this. For example here’s how to check if port 8140 is open on the box,

$ nc -v 8140
Ncat: Version 6.40 ( )
Ncat: Connected to x.x.x.x:8140.

Here’s another example, but this time to check whether a port is open on the localhost:

$ nc -v 22
Ncat: Version 6.40 ( )
Ncat: Connected to

Note: nc can’t be used to check the connection of UDP ports, for example the ntp port is a udp port, with port number 123. If you try you’ll get a ‘no route to host’ error message.