Detailed explanation of two ways of remote file transfer under Linux

scp remote file transfer

1. Copy the local file to the remote host

command:

	- `scp 本地文件  远程主机用户@远程主机ip:远程主机目录的绝对路径`
	- 参数:
	- 		-r      ##表示复制目录
	- 		-q      ##表示复制时不显示传输过程

Insert picture description here

2. Download the remote host file to this machine

command:

	- `scp 远程主机用户@远程主机IP:文件绝对路径  存到本地的绝对路径`

Insert picture description here

rsync remote file transfer

command:

rsync  文件   远程主机用户@远程主机IP:文件绝对路径
rsync  远程主机用户@远程主机IP:文件路径   文件存放在本机的路径
- 参数
- 	-r                                     ##复制目录
-   -l                                     ##复制链接
-  	-p                                     ##复制权限
-   -t                                     ##复制时间戳
- 	-o                                     ##复制文件拥有者
- 	-g                                     ##复制文件拥有组
- 	-D                                     ##复制设备文件

Now create new files, folders, and links on the server
Insert picture description here

The difference between rsync and scp

Comparison of rsync and scp: After scp is transmitted once, it will not care whether the file exists or not, or retransmit the file once. Rsync has an incremental detection function, which will take a certain amount of time to detect the file If it already exists, it will not be retransmitted.
Insert picture description here

Guess you like

Origin blog.csdn.net/qwerty1372431588/article/details/109223508
Recommended