Skip to content

Transferring Files using Netcat

Netcat is a great cross platform tool, it can be used for just about all things related to or involving TCP or UDP. Its most practical use is transferring files using Netcat from one machine to another via a network. Where non *nix people usually don’t have SSH installed or set-up, it is much faster to transfer files using Netcat than setup SSH. Netcat is just a single executable, and works across all platforms (Windows,Mac OSX, Linux).

On the Netcat receiving end

# nc -l 1234 > out.file

This will start Netcat listening on port 1234.

On the Netcat sending end

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

This will connect to the receiver and begin transferring files using Netcat.

If you’d like to transfer files quicker (*nix only I am afraid), you can compress the file during sending process

On the Netcat receiving end

# nc -l -p 1234 | uncompress -c | tar xvfp -

On the Netcat sending end

# tar cfp - /some/dir | compress -c | nc -w 3 [destination] 1234