.TH rcp "" "" "Command"
.PC "Copy a file from one trusted host to another"
\fBrcp [\-p] \fIsrcfile destfile\fR
\fBrcp [\-pr] \fIfile ... directory\fR
.PP
The command
.B rcp
copies files from one trusted host to another.
To use this command, you must have accounts on both the local and the
remote host, and both accounts must have the same login identifier.
Each host must name the other in its file
.BR /etc/hosts.equiv .
.PP
The syntax of
.B rcp
resembles that of the \*(CO command
.BR cp .
In the first form summarized above,
.B rcp
copies
.I srcfile
into
.IR destfile .
The file name for the remote system \(em whether
.I srcfile
or
.IR destfile \(em
must include the host name and the full path name of the target directory.
For example, if your login identifier is
.B fred ,
then to copy
.B textfile
from the current directory on your local host into your home directory
on system
.BR mwc ,
use the command:
.DM
	rcp textfile mwc:/usr/fred
.DE
.PP
To copy
.B textfile
back from
.B mwc
to the current directory, use the command:
.DM
	rcp mwc:/usr/fred/textfile .
.DE
.PP
This command fails if
.I srcfile
or
.I destfile
does not exist, if you lack permission to write into the target directory,
if you do not have an account on the remote system,
or if one system does not ``trust'' the other.
.PP
If
.I destfile
already exists,
.B rcp
overwrites it.
By default,
.B rcp
preserves the mode and owner of
.IR destfile ,
should it already exist;
otherwise, it uses your
.B umask
to set the permissions on
.I srcfile
when it copies it into
.IR destfile .
The option
.B \-p
tells
.B rcp
to attempt to preserve the modification times and modes of
.IR srcfile ,
and ignore your
.BR umask .
.PP
.B rcp
also handles third-party copying, where neither
.I srcfile
nor
.I destfile
are on your local host.
For example, to copy file
.B foo.c
from directory
.B /tmp
on host
.B mwc
to directory
.B /tmp
on host
.BR lepanto ,
use the command:
.DM
	rcp mwc:/tmp/foo.c lepanto:/tmp
.DE
.PP
In the second form summarized above,
.B rcp
copies each
.I file
into the target
.IR directory .
For example, to copy files
.BR foo.c ,
.BR bar.c ,
and
.B baz.c
from the current directory on your local host to directory
.B /tmp
on host
.BR mwc ,
use the command:
.DM
	rcp foo.c bar.c baz.c mwc:/tmp
.DE
.PP
You can use wildcards to select files for transmission.
For example, to copy all \fB.c\fR files from the current directory to
.B /tmp
on host
.BR mwc ,
use the command:
.DM
	rcp *.c mwc:/tmp
.DE
.PP
You can use wildcards to retrieve files from the remote system, but the
wildcards must be quoted to prevent the shell from expanding them prematurely.
For example, to copy all \fB.c\fR files from
.B /tmp
on host
.B mwc
into your the current directory, use the command:
.DM
	rcp 'mwc:/tmp/*.c' .
.DE
.PP
The command-line option
.B \-r
tells
.B rcp
to perform recursive copying:
should any
.I file
be a directory,
.B rcp
copies it and all of its files and subdirectories into the target
.IR directory .
For example, the following command copies the contents of your current
directory, and all of its subdirectories, into directory
.B /tmp
on host
.BR mwc :
.DM
	rcp -r . mwc:/tmp
.DE
.PP
.B rcp
overwrites all identically named files on the target
.IR directory .
.SH "See Also"
.B
commands,
cp,
ftp,
rlogin,
rsh
.R
