One of the main reasons that networks came into being was that users need to give each other files. The rcp (remote copy) command gives you the ability to copy files or directories between machines on the network.

Command Format

rcp source_file hostname:destination_file
rcp hostname:source_file destination_file

Examples

This example copies the file dante from the local machine to the /tmp directory on the host named saturn:

$ rcp dante saturn:/tmp

This example is the exact opposite, it copies dante from saturn to the local /tmp directory:

$ rcp saturn:/tmp/dante /tmp

Use the -r option when copying a directory to a remote host as shown here (play is a directory):

$ rcp -r ~/practice/play saturn:/tmp

Warning: Do not use /tmp for long-term file storage because the files in /tmp are cleared out each time the machine is rebooted.

Note: When users copy files between systems, the files retain the ownership of the user who executed the command.