linux rsync 学习笔记

part 1: 查看rsync 的manual
$ man rsync :
rsync(1) rsync(1)
NAME
rsync — a fast, versatile, remote (and local) file-copying tool
SYNOPSIS
Local: rsync [OPTION...] SRC... [DEST]
Access via remote shell:
Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOST:DEST
Access via rsync daemon:
Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST
Usages with just one SRC arg and no DEST arg will list the source files instead of copying.
# rsync 的使用主要有两种模式, remote shell, rsync daemo, 这里主讲 remote shell 方式

part 2: rsync 的主要应用

以如下A、B两台计算机为例:
A: jia@jia-server-svn 172.16.2.142
B: jia@jia-server-001 172.16.2.84


在A 上:
push: 将 A上的文件、文件夹传递到 B上
$ rsync -avr ue_test jia@172.16.2.84:/home/jia
$ rsync -avr test jia@172.16.2.84:/home/jia

pull: 将B上的文件、文件夹传递到A上
$ rsync -avr jia@172.16.2.84:/home/jia/test.py /home/jia

$ rsync -avr jia@172.16.2.84:/home/jia/jia_svn_test /home/jia


对本地两个两个目录同步:

$ rsync -avr filename1 filename2

# 将filename1 中的文件同步至filename2, 即 filename2中的文件与filename1 一致

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值