linux_wiki:nc

NC (netcat)

General Information

nc or netcat “is a feature-packed networking utility which reads and writes data across networks from the command line.”.

Checklist

  • Distro(s): Any

Useful Options

EL6

  • -n → do not perform DNS lookups
  • -u → use UDP instead of default TCP
  • -v → verbose
  • -w 3 → wait 3 seconds before timeout of initial connection
  • -z → Scan only

EL7

  • -n → do not perform DNS lookups
  • -u → use UDP instead of default TCP
  • -i → Idle read/write timeout (disconnect after successful connection)
  • -v → verbose
  • -w 3 → wait 3 seconds before timeout of initial connection

Examples

Netcat examples.

Test to see if you can open a connection to a port on a remote system.
This is useful to see if a firewall has correct rules.

Example: Check the remote system (192.168.1.1) for an open 443/tcp connection

  • EL6
    nc -zvw 3 192.168.1.1 443
  • EL7
    nc -i 3 -vw 3 192.168.1.1 443

  • linux_wiki/nc.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)