Linux rcp command
The Linux rcp command is used to copy remote files or directories.
The rcp command copies files or directories remotely; if you specify two or more files or directories at the same time and the final destination is an existing directory, it copies all the previously specified files or directories into that directory.
Syntax
rcp [-pr][源文件或目录][目标文件或目录]
or
rcp [-pr][源文件或目录...][目标文件]
Parameters:
-p Preserve the attributes of the source file or directory, including owner, group, permissions, and timestamps.
-r Process recursively, handling the files and subdirectories under the specified directory as well.
Example
Use the rcp command to copy a remote file to the local machine for storage.
Suppose the current account on the local host is rootlocal and the account on the remote host is root. To copy the file "testfile" from the home directory of the remote host (218.6.132.5) to the local directory "test", enter the following command:
rcp root@218.6.132.5:./testfile testfile #复制远程文件到本地
rcp root@218.6.132.5:home/rootlocal/testfile testfile
#Requires the currently logged-in account cmd to log into the remote host
rcp 218.6.132.5:./testfile testfile
Note: after the "rcp" command runs, there is no output; simply check whether the file "testfile" exists in the "test" directory. If it exists, the remote copy succeeded; otherwise, the remote copy failed.
Linux Command Reference