100% 0.00kB/s 0:00:00 (xfer#4, to-check=1/12)
shuqing/zsq.txt
0 100% 0.00kB/s 0:00:00 (xfer#5, to-check=0/12)
sent 113 bytes received 817 bytes 80.87 bytes/sec
total size is 666 speedup is 0.72
[root@sqing ~]# ls /home/shuqing/
shuqing sq.tar.gz zsq.txt
[root@sqing ~]# ls /home/shuqing/shuqing/
sq.tar.gz zsq.txt
5、将远端/home/shuqing目录shuqing文件夹本身,即/home目录下的shuqing文件夹,拷贝到本地/home/shuqing目录下.
[root@sqing ~]# rsync -avr --progress -e ssh root@10.8.9.24:/home/shuqing /home/shuqing/
root@10.8.9.24''s password:
receiving incremental file list
shuqing/
shuqing/shuqing/
shuqing/shuqing/.bash_logout
33 100% 32.23kB/s 0:00:00 (xfer#1, to-check=4/12)
shuqing/shuqing/.bash_profile
176 100% 57.29kB/s 0:00:00 (xfer#2, to-check=3/12)
shuqing/shuqing/.bashrc
124 100% 40.36kB/s 0:00:00 (xfer#3, to-check=2/12)
shuqing/shuqing/sq.tar.gz
0 100% 0.00kB/s 0:00:00 (xfer#4, to-check=1/12)
shuqing/shuqing/zsq.txt
0 100% 0.00kB/s 0:00:00 (xfer#5, to-check=0/12)
sent 114 bytes received 833 bytes 75.76 bytes/sec
total size is 666 speedup is 0.70
[root@sqing ~]# ls /home/shuqing/shuqing/
shuqing sq.tar.gz zsq.txt
[root@sqing ~]# ls /home/shuqing/shuqing/shuqing/
sq.tar.gz zsq.txt
注意第2与3、4与5步的区别了,前者是把拷贝shuqing文件夹下的数据,后者拷贝shuqing文件夹本身.
以上命令中可以看到,在DST(目标地址)目录中,的“/”有没有,无所谓,但SRC(源地址)目录中,的“/”有没有,是大不一样的.
如果远端ssh端口已更改,比如为:2345,那个,以上5项操作分别对应以下5行命令:
# rsync -avr --progress -e ''ssh -p 2345'' /home/shuqing/test.txt root@10.8.9.24:/home/shuqing
# rsync -avr --progress -e ''ssh -p 2345'' /home/shuqing/ root@10.8.9.24:/home/shuqing
# rsync -avr --progress -e ''ssh -p 2345'' /home/shuqing root@10.8.9.24:/home/shuqing/
# rsync -avr --progress -e ''ssh -p 2345'' root@10.8.9.24:/home/shuqing/ /home/shuqing
# rsync -avr --progress -e ''ssh -p 2345'' root@10.8.9.24:/home/shuqing /home/shuqing/
本文出自 “一树清劲” 博客,请务必保留此出处http://sunshyfangtian.blog.51cto.com/1405751/679964
|