Transferring Files

You may need to copy files between computers. For instance, you can put a backup copy of an important file you’re editing onto an account at a computer in another building or another city. Or, Dr. Nelson could put a copy of a data file from her local computer onto a central computer, where her colleagues can access it. Or you might want to download 20 files from an FTP server, but not want to go through the tedious process of clicking on them one by one in a web browser window. If you need to do this sort of thing often, you may be able to set up a networked filesystem connection; then you’ll be able to use the Finder or local programs such as cp and mv. But Unix systems also have command-line tools for transferring files between computers. These often work more quickly than graphical tools. We explore them later in this section.

scp and rcp

Mac OS X includes both scp (secure copy) and rcp (remote copy) programs for copying files between two computers. In general, you must have accounts on both computers to use these. The syntax of scp and rcp are similar to cp, but also let you add the remote hostname to the start of a file or directory pathname. The syntax of each argument is:

               hostname:pathname

hostname: is needed only for remote files. You can copy from a remote computer to the local computer, from the local computer to a remote computer, or between two remote computers.

The scp program is much more secure than rcp, so we suggest using scp to transfer private ...

Get Learning Unix for Mac OS X Panther now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.