29.3 scp—Secure Copy

scp copies files to a remote machine. It is a secure and encrypted substitute for rcp. For example, scp MyLetter.tex sun: copies the file MyLetter.tex from the host earth to the host sun. If the username on earth is different than the username on sun, specify the latter using the username@host format. The -l option has a different meaning for this command.

After the correct password is entered, scp starts the data transfer and shows a growing row of asterisks to simulate a progress bar. In addition, the program displays the estimated time of arrival to the right of the progress bar. Suppress all output by giving the option -q.

scp also provides a recursive copying feature for entire directories. The command scp -r src/ sun:backup/ copies the entire contents of the directory src including all subdirectories to the backup directory on the host sun. If this subdirectory does not exist yet, it is created automatically.

The option -p tells scp to leave the time stamp of files unchanged. -C compresses the data transfer. This minimizes the data volume to transfer, but creates a heavier burden on the processor.