English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux rcp command

Linux Command大全

The Linux rcp command is used to copy remote files or directories.

The rcp command is used to copy files or directories on the remote end. If two or more files or directories are specified at the same time, and the last destination is an existing directory, it will copy all the specified files or directories to that directory.

Syntax

rcp [-pr][Source file or directory][Target file or directory]

or

rcp [-pr][Source file or directory...][Target file]

Parameters:

-p Retain the attributes of the source file or directory, including owner, group, permissions, and time.

-r Recursively process, handling the files and subdirectories in the specified directory.

Online Examples

Use the rcp command to copy the remote file to the local for saving.

Assuming the current local host account is rootlocal and the remote host account is root, to copy the remote host (218.6.132.5If you want to copy the file "testfile" under the main directory to the local directory "test", enter the following command:

rcp [email protected]:./testfile testfile  # Copy the remote file to the local  
rcp [email protected]:home/rootlocal/testfile testfile  
# It is required that the current logged-in account cmd log in to the remote host  
rcp 218.6.132.5:./testfile testfile

Note: After executing the command "rcp", there will be no return information. You only need to check if the file "testfile" exists in the directory "test". If it exists, it means that the remote copy operation was successful; otherwise, the remote copy operation failed.

Linux Command大全