Network

The nc command

Netcat, the network Swiss army knife: opens TCP/UDP connections, listens on a port and checks whether a port is open. It is invoked as nc or netcat.

Syntax

nc [opciones] host puertoTry it in the terminal →

Most useful options

-lListens on a port in server mode
-zScan mode: probes the port without sending data
-vShows information about what happens
-uUses UDP instead of TCP

Copy-ready examples

$ nc -zv miguelacm.es 443Is the secure web port open?
$ nc -l 4444Listens on port 4444

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • A closed port does not always mean a failure: it may be the firewall.
  • Without -z, nc opens an interactive session and waits for data.

Related commands

FAQ

What is nc really for?

To speak TCP/UDP by hand: check ports, move data between hosts or spin up a quick server.

Does it need sudo?

Not to reach a remote port; yes to listen on ports below 1024.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course