Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
NAME
       nc (netcat) -- use network sockets from the command line

SYNOPSIS
       nc [-h]
	 [-ruvz] [-g gateway] [-G num] [-i secs] [-p port] [-o file] [-s addr]
	  [-w secs] hostname port[s] [ports] ...
	-l -p port [-nsuvwz] [-o file] [hostname] [port]

DESCRIPTION
       nc allows you to	use network sockets (tcp or udp) from the shell.

       For connecting to remote	sites, it's usually only necessary  to	supply
       the host	or ip address and port for the connection.  For	a listening on
       a socket, you must specify -l for listening, and	-p port	to specify the
       port on which you want to listen.

       The  options are	as follows (with C and S indicating whether the	option
       applies to the "client" or "server" roles in a tcp conversation):

       -g gateway (C)
	       Specifies a source routing hop for outbound connections.

       -G num (C)
	       Can be used to specify the source routing  pointer  in  the  ip
	       header,	presumably  in order to	forge unused previous steps in
	       the source routed path.

       -h      Minor help.

       -i secs (C)
	       Delay interval for lines	sent or	ports scanned.

       -l (S)  Selects "listen"	mode instead of	connect	mode  so  that	people
	       can connect to you.

       -n (S)  The -n option indicates that all	ip addresses should be printed
	       out instead of being looked up in the DNS.

       -o file (CS)
	       Sends a hex-dump	of the traffic to the specified	file.

       -p local	port number (CS)
	       When  connecting	 to  a	remote	service, this is the port from
	       which the connection will originate.  When listening for	remote
	       clients,	this specifies the local port on which to listen.

       -r (C)  Randomizes local	source ports and addresses for	outbound  con-
	       nections.

       -s source address (CS)
	       Specifies  the local source address on which to listen, or from
	       which to	connect.

       -u (CS)
	       Selects UDP transport as	opposed	to TCP (the default).

       -v (CS)
	       Turns on	verbosity.  Use	two (or	more) for more verbosity.

       -w secs (CS)
	       This sets a timeout for connects	or for final net reads.

       -z (CS)
	       Zero I/O	mode.  While mostly used for scanning,	I'm  sure  you
	       could find a way	to use it for connect mode.

       The  nc	utility	exits after both input streams (it's stdin and the re-
       mote socket) have been closed.  It doesn't do this very well,  and  re-
       lies rather heavily on the network layers at both ends for this.

SEE ALSO
       cat(1)

HISTORY
       The  nc utility,	a "damn	useful little backend utility" begun 950915 or
       thereabouts, as *Hobbit*'s first	real stab at some sockets programming.
       Something that should have and indeed may have existed ten  years  ago,
       but  never  became  a  standard	Unix utility.  IMHO, nc	could take its
       place right next	to cat,	cp, rm,	mv, dd,	ls, and	all those other	 cryp-
       tic and Unix-like things.

				October	1, 1999				 NC(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=nc&manpath=Darwin+8.0.1%2fppc>

home | help