NC(1) NC(1) (NAME) nc - TCP UDP (SYNOPSIS) nc [-46bCDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl] [-m minttl] [-O length] [-P proxy_username] [-p source_port] [-q seconds] [-s sourceaddr] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [destination] [port] (DESCRIPTION) nc ( netcat) TCP UDP (Unix-domain) . TCP UDP TCP UDP IPv4 IPv6 . telnet(1) nc ( telnet(1) ) (stderr) . : o TCP o HTTP o o ProxyCommand SOCKS HTTP ssh(1) o (OPTIONS) : -4 IPv4 . -6 IPv6 . -b (broadcast) . -C CRLF . (LF) CR+LF . (CR) . . -D (debugging) . -d (stdin) . -F sendmsg(2) (stdout) . -X nc ( ssh(1) ProxyUseFdpass ssh_config(5)). -U . -h nc . -I length TCP . -i interval interval . . -k . -l . -u UDP . -l . destination port -s -p . -x -z . -w . -M ttl TTL (hop limit) . -m minttl TTL minttl (drop ). -N EOF ( ) shutdown(2) . . -n (DNS) . DNS . -O length TCP . -P proxy_username . . HTTP CONNECT . -p source_port nc . -q seconds EOF (stdin) seconds . seconds ( ). seconds -N . -r . -S TCP MD5 RFC 2385 . -s sourceaddr (interface) . . -x . -T keyword TOS IPv4 (traffic class) IPv6 . keyword critical inetcontrol lowcost lowdelay netcontrol throughput reliability DiffServ: ef af11 af43 cs0 cs7 . -t DON'T WON'T RFC 854 DO WILL . nc telnet . -U (Unix-domain) . -F -x . (`@') (abstract namespace) : `@' NUL . unix(7) . -u TCP UDP . -x . (stream) . /tmp -s . -V rtable . -v . -W recvlimit recvlimit . -w timeout timeout . -w -l nc -w . . -X proxy_protocol proxy_protocol . 4 ( SOCKS ) 4A ( SOCKS A) 5 ( SOCKS ) connect ( HTTPS). SOCKS . SOCKS v.4 IPv4 . . -x proxy_address[:port] proxy_address port destination . port ( SOCKS HTTPS). IPv6 proxy_address . -lsuU . -Z DCCP. -z . -l . destination IP ( -n ). -l ( ). ( -l ). port . nn-mm . -U . 0 . / (CLIENT/SERVER MODEL) / nc . nc . : $ nc -l 1234 nc . ( ) : $ nc -N 127.0.0.1 1234 . . nc <<>> <<>> . -N EOF ( ^D) . netcat -c -e (file descriptors) . **** . : : $ rm -f /tmp/f; mkfifo /tmp/f $ cat /tmp/f | /bin/sh -i 2>&1 | nc -l 127.0.0.1 1234 > /tmp/f : $ nc host.example.com 1234 $ (shell prompt from host.example.com) fifo /tmp/f nc 127.0.0.1 /bin/sh . nc . -k nc . : $ rm -f /tmp/f (DATA TRANSFER) . . nc : $ nc -l 1234 > filename.out nc : $ nc -N host.example.com 1234 < filename.in . (TALKING TO SERVERS) <<>> . . : $ printf "GET / HTTP/1.0\r\n\r\n" | nc host.example.com 80 . sed(1) . . SMTP : $ nc [-C] localhost 25 << EOF HELO host.example.com MAIL FROM: RCPT TO: DATA Body of email. . QUIT EOF (PORT SCANNING) . -z nc . -v (stderr) . : $ nc -zv host.example.com 20-30 Connection to host.example.com 22 port [tcp/ssh] succeeded! Connection to host.example.com 25 port [tcp/smtp] succeeded! ( -r ). : $ nc -zv host.example.com http 20 22-23 nc: connect to host.example.com 80 (tcp) failed: Connection refused nc: connect to host.example.com 20 (tcp) failed: Connection refused Connection to host.example.com port [tcp/ssh] succeeded! nc: connect to host.example.com 23 (tcp) failed: Connection refused ( -r ). . . . -w "QUIT" : $ echo "QUIT" | nc host.example.com 20-30 SSH-1.99-OpenSSH_3.6.1p2 Protocol mismatch. 220 host.example.com IMS SMTP Receiver Version 0.84 Ready (EXAMPLES) TCP host.example.com : $ nc -p 31337 -w 5 host.example.com 42 UDP host.example.com: $ nc -u host.example.com 53 TCP host.example.com 10.1.2.3 IP : $ nc -s 10.1.2.3 host.example.com 42 : $ nc -lU /var/tmp/dsocket host.example.com HTTP 10.2.3.4 . ssh(1) ProxyCommand ssh_config(5) : $ nc -x10.2.3.4:8080 -Xconnect host.example.com 42 <> : $ nc -x10.2.3.4:8080 -Xconnect -Pruser host.example.com 42 (SEE ALSO) cat(1), ssh(1) (AUTHORS) *Hobbit* . IPv6 Eric Jackson . Aron Xu . (CAVEATS) UDP -uz . (traffic sniffer) -uz . UDP . OpenBSD 2025-06-24 NC(1)