[root@lizhipenglinux01 ~]# rsync -av /etc/passwd /tmp/1.txt
sending incremental file list
passwd
sent 1318 bytes received 31 bytes 2698.00 bytes/sec
total size is 1244 speedup is 0.92
[root@lizhipenglinux01 ~]# rsync -av /etc/passwd root@192.168.5.128:/tmp/1.txt 远程拷贝的形式
root@192.168.5.128‘s password:
sending incremental file list
sent 31 bytes received 12 bytes 5.06 bytes/sec
total size is 1244 speedup is 28.93
[root@lizhipenglinux01 ~]# rsync -av /etc/passwd 192.168.5.128:/tmp/1.txt 没有写用户,默认当前的用户
[root@lizhipenglinux01 ~]# rsync -av /root/111/ /tmp/111_dest/
sending incremental file list
created directory /tmp/111_dest
./
lizhipeng3 -> /tmp/lizhipenglinux
sent 75 bytes received 18 bytes 186.00 bytes/sec
total size is 19 speedup is 0.20
[root@lizhipenglinux01 ~]# ls -l /tmp/111_dest/
总用量 0
-rw-r--r-- 1 root root 0 1月 28 23:56 lizhipeng3
[root@lizhipenglinux01 ~]# ls -l 111/
总用量 0
lrwxrwxrwx. 1 root root 19 12月 21 04:19 lizhipeng3 -> /tmp/lizhipenglinux
[root@lizhipenglinux01 ~]# ls -l 111/
总用量 0
lrwxrwxrwx. 1 root root 19 12月 21 04:19 lizhipeng3 -> /tmp/lizhipenglinux
[root@lizhipenglinux01 ~]# echo "12133rwrwer" > /tmp/lizhipenglinux
[root@lizhipenglinux01 ~]# rsync -avL /root/111/ /tmp/111_dest/
sending incremental file list
lizhipeng3
sent 104 bytes received 31 bytes 270.00 bytes/sec
total size is 12 speedup is 0.09
[root@lizhipenglinux01 ~]# ls -l /tmp/111_dest/
总用量 4
-rw-r--r-- 1 root root 12 1月 29 00:00 lizhipeng3
[root@lizhipenglinux01 ~]# ls -l /tmp/111_dest/lizhipeng3
-rw-r--r-- 1 root root 12 1月 29 00:00 /tmp/111_dest/lizhipeng3
[root@lizhipenglinux01 ~]# cat !$
cat /tmp/111_dest/lizhipeng3
12133rwrwer
[root@lizhipenglinux01 ~]# ls !$
ls /tmp/111_dest/
lizhipeng3
[root@lizhipenglinux01 ~]# rm -rf /tmp/111_dest/*
[root@lizhipenglinux01 ~]# rsync -avL --exclude "*.txt" /root/111/ /tmp/111_dest/
sending incremental file list
./
lizhipeng3
sent 107 bytes received 34 bytes 282.00 bytes/sec
total size is 12 speedup is 0.09
[root@lizhipenglinux01 ~]# rsync /etc/passwd 192.168.5.129:/tmp/lizhipeng.txt
[root@lizhipeng02 ~]# cat /tmp/lizhipeng.txt
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:998:User for polkitd:/:/sbin/nologin
tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
lizhipeng:x:1000:1000::/home/lizhipeng:/bin/bash
user1:x:1001:1001::/home/user1:/bin/bash
lzp:x:1002:1003::/home/lzp:/bin/bash
user2:x:1003:1006::/home/user2:/bin/bash
user3:x:1004:1005::/home/user3:/bin/bash
user4:x:1006:1005::/home/lizhipeng001:/sbin/nologin
user5:x:1007:1007::/home/user5:/bin/bash
tcpdump:x:72:72::/:/sbin/nologin
[root@lizhipenglinux01 ~]# rsync -avP 192.168.5.129:/tmp/lizhipeng.txt /tmp/123.txt
receiving incremental file list
lizhipeng.txt
1244 100% 1.19MB/s 0:00:00 (xfer#1, to-check=0/1)
sent 30 bytes received 1330 bytes 906.67 bytes/sec
total size is 1244 speedup is 0.91
[root@lizhipenglinux01 ~]# rsync -avP -e "ssh -p 22" 192.168.5.129:/tmp/lizhipeng.txt /tmp/123.txt 指定22端口
[root@lizhipenglinux01 ~]# ssh -p 22 192.168.5.129 登录到2机器了
Last login: Mon Jan 29 00:53:50 2018 from 192.168.5.1
[root@lizhipeng02 ~]#