Important option of rsync.
-n, --dry-run - Perform a dry run,simulation of what happens when the command really get executed
-a , --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-p, --perms preserve permissions
-t, --times preserve modification times
-g, --group preserve group
-o, --owner preserve owner (super-user only)
-D Synchronize device files
-v, --verbose increase verbosity
-a archive mode doesn't add the following option which we need to include separately if required.
-H, --hard-links preserve hard links
-A, --acls preserve ACLs (implies -p)
-X, --xattrs preserve extended attributes, SELinux context
Important
While entering the source directory of rsync, it is important to remember that whether tailing slash(/) is present or not.
If tailing slash (/) is there only the content of the directory will be copied
with tailing slash (/) , content of etc folder will be copied
[root@server1 ~]# rsync -av /etc/ /tmp
...
yum/pluginconf.d/langpacks.conf.rpmnew
yum/pluginconf.d/product-id.conf
..
sent 86256 bytes received 11501 bytes 195514.00 bytes/sec
With-out tailing slash (/) , etc folder will also be copied
[root@server1 ~]# rsync -av /etc /tmp
..
etc/yum/pluginconf.d/langpacks.conf
etc/yum/pluginconf.d/langpacks.conf.rpmnew
etc/yum/pluginconf.d/product-id.conf
...
sent 86256 bytes received 11501 bytes 195514.00 bytes/sec
No comments:
Post a Comment