Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Forked from jtbonhomme/nc.md
Created November 10, 2020 20:52
Show Gist options
  • Save RichardBronosky/09755d1b32e49e05e927a864f054682f to your computer and use it in GitHub Desktop.
Save RichardBronosky/09755d1b32e49e05e927a864f054682f to your computer and use it in GitHub Desktop.
Using Netcat for File Transfers

Netcat is like a swiss army knife for geeks. It can be used for just about anything involving TCP or UDP. One of its most practical uses is to transfer files. Non *nix people usually don't have SSH setup, and it is much faster to transfer stuff with netcat then setup SSH. netcat is just a single executable, and works across all platforms (Windows,Mac OS X, Linux).

Destination

On the receiving (destination) terminal, run:

nc -l -p 1234 > out.file 

For mac users, use

nc -l 1234 > out.file

This will begin listening incomming data on port 1234.

Origin

On the sending terminal, run:

nc -w 3 [destination ip address] 1234 < out.file

will connect to the receiver and begin sending file. The -w 3 option stands for a 3 seconds timeout.

Blog source

http://nakkaya.com/2009/04/15/using-netcat-for-file-transfers/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment