Linux rcp command

Updated: 11/06/2021 by Computer Hope
rcp command

On Unix-like operating systems, the rcp command copies files from one networked computer to another. This page covers the Linux version of rcp.

Note

RCP is not a secure or encrypted method of transferring files. For transferring files securely, use scp or rsync, which encrypt the connection to the remote host.

Syntax

rcp [-p] [-r] file name ... directory

Options

-p Attempt to give each copy the same modification times, access times, modes, and ACLs if applicable as the original file.
-r Copy each subtree rooted at file name; the destination must be a directory.
file name Name of the file
directory Name of the directory

Caveats

rcp copies between different hosts; attempting to rcp a file onto itself, as with:

rcp tmp/file myhost:/tmp/file

...will result in a severely corrupted file.

rcp may not correctly fail when the target of a copy is a file instead of a directory.

rcp can become confused by output generated by commands in a $HOME/.profile on the remote host.

rcp requires that the source host have permission to execute commands on the remote host when doing third-party copies.

rcp does not properly handle symbolic links. Use tar or cpio piped to rsh to obtain remote copies of directories containing symbolic links or named pipes.

If you forget to quote metacharacters intended for the remote host, you get an incomprehensible error message.

rcp fails if you copy ACLs to a file system that does not support ACLs.

Examples

rcp /mydirectory/myfile hope:otherdir/myfile

This command copies the file myfile from the local path /mydirectory to the remote system named hope, placing it in the directory otherdir.

cpio — Copy files to or from archives.
ftp — Conduct an interactive FTP session over a secure network connection.
rlogin — Begin a session on a remote system.
rsh — Execute a command on a remote shell.
rsync — A fast and versatile file copying tool capable of synchronizing files across remote systems.
scp — Copy files securely over a network connection.
setfacl — Modify the access control list of a file or files.
tar — Create, modify, list the contents of, and extract files from tar archives.