Chapter 15: Network File Transfer

Chapter 15: Network File Transfer


This book's primary focus is the single-machine environment. However, any modern machine is on a network. Eventually, you will want to transfer files from one Unix machine to another. There are many ways to move files around, but the choices usually come down to these:

  • Using a simple command such as scp if you need to transfer just a few files.

  • Using an archiving program such as tar through an ssh pipeline to transfer a directory hierarchy. Here is an example:

    tar cBvf - directory | ssh remote_host tar xBvpf -

    This old method gets the job done, but it is not very flexible. In particular, after the transfer completes, the remote host may not have an exact copy of the directory. If directory already exists on the remote machine, and it contains some extraneous files, those files persist after the transfer.

  • Using a synchronizer system that duplicates an entire directory structure on the remote host. The two most popular synchronizer utilities are rsync and rdist.

  • Using old, clunky, insecure programs like ftp that you should not use.

This chapter explains the rsync system. The main advantages of rsync over other systems are these:

  • There is only one command to learn, rsync, which has a relatively simple syntax.

  • It offers relatively good performance.

  • It has multiple operating modes.