rsync - 远程shell模式和rsync守护进程模式

本文详细介绍了rsync命令的两种工作模式:远程shell模式和rsync守护进程模式。包括每种模式下的常用语法及参数说明,如-rlptgoD等效的-a参数、-e选项指定远程shell程序、-z选项进行数据压缩等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

rsync - 远程shell模式和rsync守护进程模式

# rsync - 远程shell模式和rsync守护进程模式
# rsync作为客户端,有两种工作模式,远程shell模式和rsync守护进程模式
# 远程shell模式常见语法分别如下:
# /usr/bin/rsync 是rsync命令的路径。
# -a, --archive
# This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything (with -H being a notable omission). The only exception to the above equivalence is when --files-from is specified, in which case -r is not implied.
# 等价于-rlptgoD。简言之即是想最大限度的保留所有事物(值得注意的是忽略了-H)。仅在指定了--files-from时不等价,此时不执行-r。
# -e, --rsh=COMMAND
# This option allows you to choose an alternative remote shell program to use for communication between the local and remote copies of rsync. Typically, rsync is configured to use ssh by default, but you may prefer to use rsh on a local network。
# 该选项允许选择一个远程shell应用程序用于rsync在本地和远程副本间通讯,通常,rsync默认配置成使用ssh,但是在一个本地网络中也可以使用rsh。
# /bin/ssh 是本地ssh命令的路径。
# -i 是ssh命令指定私钥的参数
# identity_file 是ssh命令使用私钥的路径
# USER 是登录用的帐户,应当和identity_file对应
# HOST 是远程的主机
# /path/to/source/ 是远程的路径
# /path/to/destination/ 是本地的路径
/usr/bin/rsync -a-e"/bin/ssh -i identity_file"USER@HOST:/path/to/source/ /path/to/destination/
# rsync守护进程模式常见语法分别如下:
# /usr/bin/rsync 是rsync命令的路径。
# -a, --archive
# This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything (with -H being a notable omission). The only exception to the above equivalence is when --files-from is specified, in which case -r is not implied.
# 等价于-rlptgoD。简言之即是想最大限度的保留所有事物(值得注意的是忽略了-H)。仅在指定了--files-from时不等价,此时不执行-r。
# -u, --update
# This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file. (If an existing destination file has a modification time equalto the source file's, it will be updated if the sizes are different.)
# 强制rsync跳过目标上已存在而且比源文件新的任何文件。(如果一个已存在的目标文件的修改时间和源文件相等,则在尺寸不同时更新)
# -z, --compress
# With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted -- something that is useful over a slow connection.
# 使用该选项,rsync在发送到目标设备前压缩文件数据,这将减少传输文件的数量——对于慢速连接有用处
# HOST 是远程的主机
# module 是rsync守护进程中的模块名
# /path/to/destination/ 是本地的路径
/usr/bin/rsync -auzHOST::module /path/to/destination/

[相关问题]

全局常用配置说明

模块常用配置说明

客户端常用参数

for Windows (cygwin)

远程shell模式和rsync守护进程模式

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值