UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: pwdChapter 2
Unix Commands
Next: Reference: regcmp
 

rcp

rcp [options] sources target

Copy files between machines. Both sources and target are filename specifications of the form host:pathname, where host: can be omitted for a file on the local machine. If no pathname is included in target, source files are placed in your home directory. If you have a different username on the remote host, specify the form username@hostname:file. See also ssh.

Options

-p

Preserve in copies the modification times, access times, and modes of the source files.

-r

If target and sources are both directories, copy each subtree rooted at source. Bear in mind that both symbolic and hard links are copied as real files; the linking structure of the original tree is not preserved.

Examples

Copy the local files junk and test to your home directory on machine hermes:

rcp junk test hermes:

Copy the local bin directory and all subdirectories to the /usr/tools directory on machine diana:

rcp -r /bin diana:/usr/tools

Copy all files in your home directory on machine hera, and put them in local directory /home/daniel with times and modes unchanged:

rcp -p "hera:*" /home/daniel

Quote the first argument to prevent filename expansion from occurring on the local machine.


Previous: Reference: pwdUNIX in a Nutshell: System V EditionNext: Reference: regcmp
Reference: pwdBook IndexReference: regcmp

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System