Using HP-UX Internet Services (February 2007)

4 Transferring Files with rcp
The rcp command allows you to copy files between HP-UX or UNIX hosts. You can
also copy the contents of an entire directory, including the contents of all its
subdirectories, using the rcp command. From your local host, you can also copy files
between two remote hosts.
Enabling rcp
Before you can use rcp to copy files to or from a remote host, the remote host must be
configured in one of the following methods:
You must have an account on the remote host with the same login name as your
local login name and the name of your local host must be in the remote host’s
/etc/hosts.equiv file.
You must have an account on the remote host, and the name of your local host
and your local login name must be in a .rhosts file in your home directory on
the remote host.
For more information, see “Creating a $HOME/.rhosts File on a Remote Host” (page 17).
For more information about rcp, type man 1 rcp at the HP-UX prompt.
Using rcp
You can use rcp to copy one or more files or directories from the local host to a remote
host, as in the following example:
rcp /tmp/memo1 /tmp/memo2 basil:/home/roger
This example copies the files /tmp/memo1 and /tmp/memo2 from the local host to
the user Rogers home directory on the host basil. The last path specified on the
command line is considered as the destination path. The files specified in the paths
before the destination path denote the files that are to be copied.
You can use rcp to copy one or more remote files or directories to the local host. With
the -r (recursive) option, you can use rcp to copy the contents of a directory and all
its subdirectories, as in the following example:
rcp -r sage:/home/gwen /home/gwen
This example copies the contents of user gwens home directory from the host sage
to the directory /home/gwen on the local host.
If you do not specify the entire path name, the path name is interpreted relative to your
home directory, as in the following example:
rcp memo* *mail sage:june_mail
Enabling rcp 21