rcp(1N) — MISC. REFERENCE MANUAL PAGES
NAME
rcp − remote file copy
SYNOPSIS
rcp [ −p ] filename1 filename2
rcp [ −pr ] filename...directory
DESCRIPTION
The rcp command copies files between machines. Each filename or directory argument is either a remote file name of the form:
hostname:path
or a local file name (containing no : characters, or a / before any : characters).
If path is not a full path name, it is interpreted relative to your home directory on hostname. A path on a remote host may be quoted (using \, ", or ’) so that the metacharacters are interpreted remotely.
rcp does not prompt for passwords; your current local user name must exist on hostname and allow remote command execution by rsh(1).
rcp handles third party copies, where neither source nor target files are on the current machine. Hostnames may also take the form
username@hostname:filename
to use username rather than your current local user name as the user name on the remote host. rcp also supports Internet domain addressing of the remote host, so that:
username@host.domain:filename
specifies the username to be used, the hostname, and the domain in which that host resides. Filenames that are not full path names will be interpreted relative to the home directory of the user named username, on the remote host.
The following options are available:
−p Attempt to give each copy the same modification times, access times, and modes as the original file.
−r Copy each subtree rooted at filename; in this case the destination must be a directory.
FILES
$HOME/.profile
SEE ALSO
ftp(1), rlogin(1), rsh(1), hosts.equiv(4).
DIAGNOSTICS
Most diagnostics are self-explanatory. “Permission denied” means either that the remote user does not have permission to do what you want or that the remote user is not equivalent to you.
WARNINGS
If a remote shell invoked by rcp has output on startup, rcp will get confused. This is never a problem with sh(1), because it is not called as a login shell.
NOTES
rcp is meant to copy between different hosts; attempting to rcp a file onto itself, as with:
rcp tmp/file myhost:/tmp/file
results in a severely corrupted file.
rcp does not detect all cases where the target of a copy might be a file in cases where only a directory should be legal.
rcp can become confused by output generated by commands in a $HOME/.profile on the remote host.
rcp requires that the source host have permission to execute commands on the remote host when doing third-party copies.
If you forget to quote metacharacters intended for the remote host you get an incomprehensible error message.
If you are copying a directory to a remote machine, rcp −r behaves differently if the directory name ends with a slash (/). If the directory name is specified without a slash, rcp creates a new directory with that name on the remote machine and puts the contents of the local directory into the newly created remote directory. If the source directory name ends with a slash, rcp copies the contents of the local directory but does not create a new directory on the remote machine.
For example, assume that your local machine has the directory stuff that contains file1 and file2. You are copying this directory to /tmp/things on the remote machine. The command
rcp −r stuff remote:/tmp/things
would create this directory structure:
remote:/tmp/things/stuff/file1
remote:/tmp/things/stuff/file2
On the other hand, the command
rcp −r stuff/ remote:/tmp/things
would create this directory structure:
remote:/tmp/things/file1
remote:/tmp/things/file2
— TCP/IP