Where to start First steps track · 15 stages
Linux Labs

nc — checking ports and transferring data

cheat sheet · netcat (openbsd/ncat) https://lab.dimsanych.ru/en/wiki/nc/

Cheat sheet

  • nc -zvw3 host 22 is the port open? (refused vs timed out)
  • nc -zvu host 53 UDP
  • nc -zv host 20-25 a range
  • nc -l 9000 listen (a test server)
  • echo data | nc host 9000 send
  • nc -l 9000 > out.bin receive a file (on the other side — nc host 9000 < file.bin)

Options

Option Meaning
-z scan mode: only check, don't send data
-v verbose output (refused / open / timed out)
-u UDP instead of TCP
-l listen (server mode)
-p N the local port
-w N connection timeout, in seconds
-n skip DNS resolution (faster)
-k (with -l) don't close after one client
Loading…