每天一个Linux命令-rsync.

发布时间 2023-06-21 16:26:26作者: 520_1351

rsync is a file transfer program capable of efficient remote update via a fast differencing algorithm.

关于笔者常用到的一些选项如下:

Options
 -v, --verbose               increase verbosity
    --info=FLAGS            fine-grained informational verbosity
    --debug=FLAGS           fine-grained debug verbosity
    --msgs2stderr           special output handling for debugging
 -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    --no-OPTION             turn off an implied OPTION (e.g. --no-D)
 -r, --recursive             recurse into directories
 -l, --links                 copy symlinks as symlinks
 -p, --perms                 preserve permissions
 -o, --owner                 preserve owner (super-user only)
 -g, --group                 preserve group
 -D                          same as --devices --specials
 -t, --times                 preserve modification times
 -z, --compress              compress file data during the transfer
     --compress-level=NUM    explicitly set compression level
     --skip-compress=LIST    skip compressing files with a suffix in LIST

关于使用rsync进行文件传输的场景举例: 

1、将本机的  /rhel/patch/ 目录下的全部同步上传到 远程主机的 /dc-patch/ 目录

[root@qq-5201351 ~]# rsync -az /rhel/patch/  192.168.88.89:/dc-patch/

执行后,需要输入远程主机的密码,没有指定用户名,即代表的当前的用户名,这里为root用户 

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17496575.html