(1)作为本地复制目录应用(类似于cp命令)
案例一:
cd /tmp/
ls
rsync /etc /hosts /tmp/
ls
#ls最后你就看见你复制的hosts
案例二:
mkdir /huang_dir -p
touch /huang_dir/file{1..5}.txt
ls /huang_dir/
rsync /huang_dir/ /tmp/
rsync -r /huang_dir/ /tmp/
ls
ls /huang_dir/
(2)作为删除数据命令应用(类似于rm命令)
案例一:
mkdir /opt/null -p
rsync -r --delete /opt/null/ /tmp/
ls
案例二:
echo "www.huang.com" >file1.txt
[root@backup tmp]# cat file1.txt
www.huang.com
[root@backup tmp]# touch null.txt
[root@backup tmp]# rsync -r --delete /tmp/null.txt file1.txt
[root@backup tmp]# cat file1.txt
(3)作为查询数据命令应用(类似于ls命令)
rsync /etc/hosts
rsync /etc