shellspells beta


nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]
   [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [hostname] [port[s]]

nc (or netcat) is used for just about anything under the sun involving TCP or UDP.

netcat is often described as the 'TCP and UDP swiss army knife'. It has many uses, such as simple TCP proxies, shell-script based HTTP clients and servers, network daemon testing, ssh scripting and much more.


Opening a raw connection to a port (like telnet)

$ nc 25

Transfer a file

# Server
$ nc -l -p 3333 > backup.iso
# Client
$ nc myserver 3333 < backup.iso 

# or

# Server
$ nc -l -p 3000 > file.txt
# Client
$ cat file.txt | nc myserver 3000

Simulate the talk utility

$ nc -l -p 3333
$ nc loki 3333

Scan a list of ports on a server

$ nc -v -w2 -z myserver 20-30

Clone a partition

$ nc -l -p 1234 | dd of=/dev/sda
$ dd if=/dev/sda | nc myserver 1234

Dictionary lookup

$ nc 2628
DEFINE wn server

ssh ProxyCommand to hop through one box to another

# In your .ssh/config file
# connect to box2 via box1
Host box2
  ProxyCommand ssh box1 nc box2 22