A few days ago, my main machine went kaput and I needed a fast way to copy several hundred gigs of data to a slow, old 2Ghz Celeron. Thus began my search for the lightest file-copying solution I could find. So far, that’s tar with netcat.
The problem is that netcat, while a swiss army knife, is also very much a power-user’s tool and, with at least three flavors and multiple versions of each in use, the instructions for using netcat with tar to copy files are often using a subtly incompatible syntax.
It also doesn’t help that, because netcat has no clue what you’re planning to do with it, it takes a little experimentation to figure out which instructions match up with your expectations for how a file-moving tool should behave.
Here is a little wrapper script I wrote myself (¾ comments) to keep the use of tar+netcat simple and easy to remember. Use it as you will.
If you aren’t on a LAN and bandwidth is more the issue, you can either compress the tar stream the same way you’d compress a tar archive (check out lzop for something lighter on the CPU than gzip) or you can use a tool like rsync which will only transfer changes and makes resuming an interrupted transfer effortless.
You may also want to check out these pages for alternatives:
- How to transfer large amounts of data via network
- BackupYourSystem – Ubuntu Wiki (Also BackupYourSystem/TAR)
Ultra-lightweight Network File Moving for Linux/UNIX by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Pingback: Ultra-lightweight Network File Moving for Linux/UNIX | BSD - Vše o BSD