What does nc do?

open, listen on, or script raw TCP/UDP connections (netcat).

▸ Explain your own nc command →

nc examples, explained

$ nc -lvnp 4444

  • ncopen, listen on, or script raw TCP/UDP connections (netcat)
  • -llisten for an incoming connection instead of connecting
  • -vverbose — report connections and errors
  • -nnumeric only — skip DNS/service-name lookups
  • -puse this source port
  • 4444value for -p

$ nc -zv host 22

  • ncopen, listen on, or script raw TCP/UDP connections (netcat)
  • -zzero-I/O mode — just scan for listening ports, send no data
  • -vverbose — report connections and errors
  • hostan argument passed to the command
  • 22an argument passed to the command

nc flags & options

-llisten for an incoming connection instead of connecting
-vverbose — report connections and errors
-nnumeric only — skip DNS/service-name lookups
-puse this source port
-uuse UDP instead of TCP
-kkeep listening for more connections after one closes
-wgive up after this many seconds of inactivity (timeout)
-zzero-I/O mode — just scan for listening ports, send no data
-suse this source address

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.