Skip to content

netcat cheatsheet

Basics

Listen on TCP port

nc -nl 1234

Specify on which IP address to listen on

nc -nl 127.0.0.1 1234

Sending files

Send a file to the remote host

Receiver

nc -nlv PORT > /path/to/file

Sender

nc -nv IP PORT < /path/to/file

Host and download file from the server

Bind nc with content of the file on local port

nc -lp PORT < /path/to/file

Then grab a file from other host

nc HOST PORT > output.file