In Unix, what is rcp, and how do I use it?
Note: The software discussed here is no longer in common use at Indiana University, and UITS may no longer be able to verify the document's accuracy. The UITS Support Center may no longer have the manuals and other materials required to support this software adequately.
Note: Because rcp is inherently insecure,
UITS strongly recommends that you do not use it. UITS
computers will not accept rcp requests. For a secure
alternative, try scp, which is installed on all UITS
Unix computers.
The rcp command is used to copy files between different
computers without starting an FTP session or logging into the
remote system explicitly. To use the rcp command, you must
have every system you intend to use as a source or destination in your
.rhosts file.
The syntax for the rcp command is as follows:
rcp filename1 filename2
rcp filename1 ... directory
In the example above, each instance of filename or
directory is in the form hostname:filename.
If the file is on your local system, you can omit
hostname: .
For example, if you are on a computer called motorhead.rock.net
and you want to copy the files foo.c ,
bar.c , and baz.c to a directory called
source in your account on a computer called
ministry.rock.net, you would enter the following:
rcp foo.c bar.c baz.c ministry:source
There are a number of problems you might encounter when trying to use
rcp:
- Wildcards on the remote system must be in quotes. This is because
the Unix shell expands unquoted wildcards, not
the
rcpcommand.
- If you copy a file onto itself by accident, your file will be
trashed.
- Copying symbolic links with
rcpdoesn't work. In this case, you're better off using FTP or the tar command instead.
Also see:
- In Unix, how do I use the scp command to securely transfer files between two computers?
- From a Unix account, how do I connect to another shared computer?
Last modified on February 04, 2005.






