LinuxCommandLibrary

nc

TLDR

Listen on port

$ nc -l [8080]
copy
Connect to host
$ nc [host] [port]
copy
Send file
$ nc [host] [port] < [file.txt]
copy
Receive file
$ nc -l [port] > [file.txt]
copy
Port scan
$ nc -zv [host] [20-30]
copy
UDP mode
$ nc -u [host] [port]
copy
Set timeout
$ nc -w [5] [host] [port]
copy
Verbose mode
$ nc -v [host] [port]
copy

SYNOPSIS

nc [options] [host] [port]

DESCRIPTION

nc (netcat) is a networking utility. It reads and writes data across network connections.
The tool creates TCP/UDP connections. Often called the "network Swiss army knife."
nc is versatile network tool.

PARAMETERS

HOST

Target hostname or IP.
PORT
Port number or range.
-l
Listen mode.
-v
Verbose output.
-z
Zero-I/O mode (scanning).
-u
UDP mode.
-w SECS
Timeout seconds.
--help
Display help information.

CAVEATS

Multiple implementations exist. Features vary by version. Security implications.

HISTORY

Netcat was written by Hobbit in 1996 and has become an essential network debugging tool.

SEE ALSO

ncat(1), socat(1), telnet(1)

Copied to clipboard