Network
The nc command
The network 'Swiss army knife': checks whether a port is open, transfers data or listens.
Syntax
nc -zv host puerto | nc -l puertoMost useful options
-zOnly checks, without sending data-vShows details-lListen modeCopy-ready examples
$ nc -zv localhost 22Is SSH open?You can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- Without -z, nc waits for data: it looks like it hangs.
FAQ
What is nc -l for?
To open a port and receive a connection, handy for quick tests.
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