nc [hostname] [port...]

Arbitrary TCP and UDP connections and listens

Arguments

NameDescription
hostnameHostname or IP address to listen on or connect to
portPort to listen on or connect to

Options

NameDescription
-4 [arg]Forces nc to use IPv4 addresses only
-6 [arg]Forces nc to use IPv6 addresses only
-A [arg]Set SO_RECV_ANYIF on socket
-b <boundif>Specifies the interface to bind the socket to
-c [arg]Send CRLF as line-ending
-D [arg]Enable debugging on the socket
-C [arg]Force nc not to use cellular data context
-d [arg]Do not attempt to read from stdin
-h [arg]Prints out nc help
-i <interval>Specifies a delay time interval between lines of text sent and received
-G <conntimeout>TCP connection timeout in seconds
-H <keepidle>Initial TCP keep alive timeout in seconds
-I <keepintvl>Interval for repeating TCP keep alive timeout in seconds
-J <keepcnt>Number of times to repeat TCP keep alive packets
-k [arg]Force nc to stay listening for another connection after its current connection is completed
-l <port>Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote host
-L <num_probes>Number of prbes to send to the peer before declaring that the peer is not reachable
-n [arg]Do not do any DNS or service lookups on any specified addresses, hostnames or ports
-p <source_port>Specifies the source port nc should use, subject to privilege restrictions and availability
-r [arg]Specifies that source and/or destination ports should be chosen randomly instead of sequentially within a range or in the order that the system assigns them
-s <source_ip_address>Specifies the IP of the interface which is used to send the packets
-t [arg]Causes nc to send RFC 854 DON'T and WON'T responses to RFC 854 DO and WILL requests
-U [arg]Specifies to use Unix Domain Sockets
-u [arg]Use UDP instead of the default option of TCP
-v [arg]Have nc give more verbose output
-w <timeout>If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed
-X <proxy_version>Requests that nc should use the specified protocol when talking to the proxy server
-x <proxy_address[:port]>Requests that nc should connect to hostname using a proxy at proxy_address and port
-z [arg]Specifies that nc should just scan for listening daemons, without sending any data to them
--apple-delegate-pid [arg]Requests that nc should delegate the socket for the specified PID
--apple-delegate-uuid [arg]Requests that nc should delegate the socket for the specified UUID
--apple-ext-bk-idle [arg]Requests that nc marks its socket for extended background idle time when the process becomes suspended
--apple-nowakefromsleep [arg]When the parameter n is greater than 0, requests that nc marks its socket to exlude the local port from the list of opened ports that is queried by drivers when the system goes to sleep args
--ecn [arg]Requests that nc marks to use the socket option TCP_ECN_MODE to set the ECN mode