1. Technology
Linux / Unix Command: rcp
Command Library

NAME

rcp - remote file copy

EXAMPLES

SYNOPSIS

rcp [-px ] file1 file2
rcp [-px ] [-r ] file ... directory

SEE ALSO

scp(1), cp(1), ftp(1), rsh(1), rlogin(1)

DESCRIPTION

Rcp copies files between machines. Each file or directory argument is either a remote file name of the form ``rname@rhost:path'', or a local file name (containing no `:' characters, or a `/' before any `:'s).

-r
If any of the source files are directories, rcp copies each subtree rooted at that name; in this case the destination must be a directory.
-p
The -p option causes rcp to attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignoring the umask By default, the mode and owner of file2 are preserved if it already existed; otherwise the mode of the source file modified by the umask(2) on the destination host is used.

If path is not a full path name, it is interpreted relative to the login directory of the specified user ruser on rhost or your current user name if no other remote user name is specified. A path on a remote host may be quoted (using \, ", or ´) so that the metacharacters are interpreted remotely.

Rcp does not prompt for passwords; it performs remote execution via rsh(1), and requires the same authorization.

Rcp handles third party copies, where neither source nor target files are on the current machine.

EXAMPLES

The command rcp copies files between computer systems. To be able to use the rcp command, both computers need a ".rhosts" file in the user's home directory, which would contain the names of all the computers that are allowed to access this computer along with the user name. Here is an example of an .rhosts file:
   zeus.univ.edu jdoe
   athena.comp.com mjohnson
The ftp command can be used to copy files between computers if no .rhosts file is set up.

The following examples illustrate how rcp works. The rcp command is similar to cp except that the remote computer and possibly the username on the remote computer needs to be prefixed to the file name.

   rcp document1 zeus.univ.edu:document1 
Copies "document1" from the local machine to the user's home directory on the computer with URL zeus.univ.edu, assuming that the user names are the same on both systems.

   rcp document1 jdoe@:zeus.univ.edu:document1
Copies "document1" from the local machine to the home directory of user "jdoe" on the computer with URL zeus.univ.edu.

   rcp zeus.univ.edu:document1 document1
Copies "document1" from the remote computer zeus.univ.edu to the local machine with the same name.

   rcp -r documents zeus.univ.edu:backups 
Copies the directory "documents", including all subdirectories, from the local machine to the directory "backups" in the user's home directory on the computer with URL zeus.univ.edu, assuming that the user names are the same on both systems.

   rcp -r zeus.univ.edu:backups/documents study
Copies the directory "documents", including all subdirectories, from the remote machine to the directory "study" on the local machine.

SEE ALSO

scp(1), cp(1), ftp(1), rsh(1), rlogin(1)

Important: Use the man command (% man) to see how a command is used on your particular computer.

>> Linux/Unix Command Library

>> Shell Command Library

You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

©2014 About.com. All rights reserved.