ARCHIVED: In Unix, what is rcp, and how do I use it?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

Note: The software discussed here is no longer in common use at IU, and UITS may no longer be able to verify this text's accuracy; additionally, the UITS Support Center may no longer have the materials needed to adequately support this software.

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 rcp command.
  • If you copy a file onto itself by accident, your file will be trashed.
  • Copying symbolic links with rcp doesn't work. In this case, you're better off using FTP or the tar command instead.

This is document adwy in the Knowledge Base.
Last modified on 2018-01-18 12:13:37.

Contact us

For help or to comment, email the UITS Support Center.