rcp(1) rcp(1)
NAME
rcp - copy a file to or from a remote host (remote file copy)
SYNOPSIS
rcp[ -xp] file1 file2 Format 1
rcp[ -xpr] file ... dir Format 2
DESCRIPTION
The rcp command allows you to copy files and directories
- from a local host to a remote host,
- from a remote host to a local host,
- between two remote hosts.
This command is used, for example, if you wish to work with files that
are located on a remote host.
Format 1 of the rcp command copies a file from one host to a file on
another host.
Format 2 copies several files or a directory (with -r) from one host
to a directory on another host.
The rcp command can only be used if you have the correct access per-
missions at the remote host. You have access permission on a remote
host if
- either your local host name or a plus sign + and your login name
have been entered in the .rhosts file in the home directory for the
login used on the remote host or
- your local host name has been entered in the /etc/hosts.equiv file
on the remote host, and the user can work on the remote host under
the same login name as on the local host.
Page 1 Reliant UNIX 5.44 Printed 11/98
rcp(1) rcp(1)
FORMAT 1: COPYING SINGLE FILES
rcp[ -xp] file1 file2
OPTIONS
No option specified:
Each copy is assigned the current time as its modification and
access times. The mode of the copy (i.e. its permissions) is
determined by umask.
-x This option is only relevant if the file to be copied is
located on a remote host. rcp then passes the -x option on to a
local rsh call, i. e. rcp returns the end status of the remote
command as its own end status.
-p Each copy is given the same modification times, access times,
and modes as the original file.
file1 Name of the file to be copied. It can be stored on the local
host or on a remote host.
If the file is stored on the local host, the file name may be
specified in the form:
path
where path is the path name for file1. If path is not an abso-
lute path name, it is interpreted as being relative to the
current working directory.
If the file is stored on a remote host, file1 must be specified
in the form:
login@remotehost:path or
remotehost:path or
login@remotehost.domain:path
remotehost is the name of the remote host.
login is the login name at the remote host.
path is the path name for file1.
domain is the name of the domain in which that host resides.
Path names may include the usual metacharacters (e.g. *, ?) for
file name generation. These metacharacters are interpreted at
the local host. If the path contains a colon ":", it must be
preceded by a forward slash "/". The character string for
login@remotemachine must not contain a forward slash "/".
Page 2 Reliant UNIX 5.44 Printed 11/98
rcp(1) rcp(1)
file2 Name to be given to the copied file. This file can be located
on the local host or on a remote host. If a file with this name
already exists, it will be overwritten.
The format is the same as for file1.
FORMAT 2: COPYING SEVERAL FILES OR DIRECTORIES
rcp [-xpr] file ... dir
OPTIONS
No option specified:
Each copy is assigned the current time as its modification and
access times. The mode of the copy (i.e. its permissions) is
determined by umask.
-x This option is only relevant if the files to be copied are
located on a remote host. rcp then passes the -x option on to a
local rsh call, i. e. rcp returns the end status of the remote
command as its own end status.
-p Each copy is given the same modification times, access times,
and modes as the original file.
-r All subtrees rooted at dir are copied recursively; in this case
the destination file must be a directory.
file may be any of the following:
- a file,
- several files, or
- a directory (with -r)
on a local or remote host.
The following format is used at local hosts:
filename ... or
directory
filename is the name or path name of one or more files.
directory is the name or path name of a directory.
If file is located on a remote host, it must be specified in
the form:
Page 3 Reliant UNIX 5.44 Printed 11/98
rcp(1) rcp(1)
login@remotehost:path or
remotehost:path or
login@remotehost.domain:path
remotehost is the name of the remote host.
login is the login name at the remote host.
path is the path name for file1.
domain is the name of the domain in which the remote host resides.
Path names may include the usual file name generation meta-
characters (e.g. *, ?). These metacharacters are interpreted at
the local host. If the path contains a colon ":", it must be
preceded by a forward slash "/". The character string for
login@remotemachine must not contain a forward slash "/".
Example:
$ rcp remotehost:path1/* path2/dir
copies all files that match the first path name to the
specified directory.
dir is the directory into which one or more files are to be copied.
It may be located on the local host or on a remote host. If
files with the same names already exist in the directory, they
will be overwritten.
The format for dir at the local host is:
directory
The format for dir at the remote host is:
login@remotehost:directory
or
login@remotehost.domain:directory
EXAMPLES
Example 1
User john would like to copy the file test from his current directory
to user frank at host seattle. The file is to be given the name
johntest on host seattle. Access permission has been granted.
$ rcp test frank@seattle:johntest
Page 4 Reliant UNIX 5.44 Printed 11/98
rcp(1) rcp(1)
Example 2
User john at host detroit wants to copy the directories test and exer-
cise from host seattle to the directory /usr/maggie on host boston.
The login name john exists on both seattle and boston and has access
permission there.
$ rcp -r seattle:test seattle:exercise boston:/usr/maggie
FILES
/etc/hosts.equiv
List of host names; users with the same login name on both the
local and remote host may access the local host from any of the
remote hosts listed in this file.
$HOME/.rhosts
List of host name/login name combinations identifying users with
permission to log in under their login name.
SEE ALSO
ftp(1), rlogin(1), rsh(1).
Page 5 Reliant UNIX 5.44 Printed 11/98