Thomas' Tech Tips

Use netcat to copy a file over the network

2 October 2022 - Thomas Damgaard

netcat or nc is a handy network swiss army knife.

It can even be used to copy a file from one host to another over the network.

This is how you do it:

On the server, run:

nc -l -p 8080 > somefile.txt

On the client, run:

cat somefile.txt | nc 8080

This will copy somefile.txt from the client to the server on using port 8080

Filed under: linux, netcat, network, tips

Back to article list