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.
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 TCPCopy-ready examples
$ nc -zv miguelacm.es 443Is the secure web port open?$ nc -l 4444Listens on port 4444You 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.
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.
More Network commands
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