tar pipe with nc, updated for 2019

If you’re a Linux user, you’re probably familiar with the so called tar pipe, a quick and dirty method for transferring files across the local network. It works, and it uses the most basic of tools. Indeed, if you want to shove a load of data between two Windows machines as a one-off, e.g. for a backup, I often find it quickest to boot them both from a Linux live CD / USB stick and use tar pipe (ntfs-3g to mount the disks, naturally). Much easier than trying to persuade file sharing to work properly.

My personal variant, on systemrescuecd:

sending end:~# tar cvf - * | nc receiving-end 1234

receiving end:~# nc -l -p 1234 | tar xv

The addition of v for verbose means you get a print out of files being sent and arriving, giving you a crude approximation of progress and a rough idea of when it’s finished.

It’s also worth noting that the connection provided by netcat is bidirectional (it’s just a TCP socket), so you can in fact establish it the other way round (which is handy if the receiving end is e.g. the Windows Subsystem For Linux, where the Windows firewall gets in the way of listening for an inbound connection):

sending end:~# tar cvf - * | nc -l -p 1234

receiving end:~# nc receiving-end 1234 | tar xv