rsync

rsync命令

//Rsync的命令格式常用的有以下三种:
rsync [OPTION]… SRC DEST
rsync [OPTION]… SRC [USER@]HOST:DEST
rsync [OPTION]… [USER@]HOST:SRC DEST
  
//对应于以上三种命令格式,rsync有三种不同的工作模式:
1)拷贝本地文件。当SRC和DES路径信息都不包含有单个冒号":"分隔符时就启动这种工作模式。如:
[root@localhost ~]# ls
anaconda-ks.cfg nfs.sh
[root@localhost ~]# rsync -a nfs.sh a.sh
[root@localhost ~]# ll
total 12
-rw-------. 1 root root 1453 Jun 13 19:27 anaconda-ks.cfg
-rwxr-xr-x 1 root root 1041 Aug 8 18:14 a.sh
-rwxr-xr-x 1 root root 1041 Aug 8 18:14 nfs.sh
[root@localhost ~]# ll -i
total 12
33574978 -rw-------. 1 root root 1453 Jun 13 19:27 anaconda-ks.cfg
33574979 -rwxr-xr-x 1 root root 1041 Aug 8 18:14 a.sh
33574990 -rwxr-xr-x 1 root root 1041 Aug 8 18:14 nfs.sh

2)使用一个远程shell程序(如rsh、ssh)来实现将本地机器的内容拷贝到远程机器。当DST路径地址包
含单个冒号":"分隔符时启动该模式。如:
[root@localhost ~]# rsync -avz nfs.sh root@172.16.12.129:/root/b.sh
sending incremental file list
nfs.sh

sent 643 bytes received 35 bytes 1,356.00 bytes/sec
total size is 1,041 speedup is 1.54
[root@localhost ~]# ssh root@172.16.12.129 ‘ls -l /root’
total 8
-rw-------. 1 root root 1454 Aug 6 04:39 anaconda-ks.cfg
-rwxr-xr-x 1 root root 1041 Aug 8 2018 b.sh

3)使用一个远程shell程序(如rsh、ssh)来实现将远程机器的内容拷贝到本地机器。当SRC地址路径
包含单个冒号":"分隔符时启动该模式。如:
[root@localhost ~]# ls
anaconda-ks.cfg a.sh nfs.sh
[root@localhost ~]# rsync -avz root@172.16.1

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值