I know you can use -a or --archive to activate archive mode when using rsync. Unfortunately, I have no idea what archive mode is supposed to do, and the man page is not at all explicit about what this is:

equals -rlptgoD (no -H,-A,-X)

Can you explain what those options (rlptgoD) mean and what's the behaviour of rsync when I use them?

It's all of these:

-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 same as --devices --specials

--devices preserve device files (super-user only)

--specials preserve special files

It excludes:

-H, --hard-links preserve hard links

-A, --acls preserve ACLs (implies -p)

-X, --xattrs preserve extended attributes

It's perfect for backups. My "default" set of switches is -avzP - archive mode, be verbose, use compression, preserve partial files, display progress.

Note: Invariably when the descriptions say "preserve", it means make the destination be like the source.

  • 19
    +1 - yes, it's in the man page, but it's also nice to see it here with the answer for easy reference – cwd Dec 21 '14 at 5:43
  • 3
    easier than looking in the man page :P ? – Salami Oct 12 '15 at 5:39
  • 1
    +1 for sharing the option combination for backups (-avzP). – RoboAlex Mar 3 '16 at 5:48
  • 1
    yeah somewhere along the way, lmgtfy became easier than man rsync. – Stu Mar 17 '16 at 13:40
  • eh.. could someone point which option of -avzP is for partial files? Isn't it --partial, without a short version? (rsync 3.1.0) – xealits Jan 27 '17 at 17:05

The archive switch is just a shortcut to skip having to enter a bunch of switches that you'll normally use if you're using rsync to make backups (a common task).

It's the same as typing:

rsync -r -l -p -t -g -o -D

And it's much easier to remember. You can find definitions for all of those switches in the man page.

(The hyphens are optional when you're combining multiple single-letter switches.)

  • 8
    thanks, but I think you're missing my point. Can you please explain what combining all those options does without having me read 7 different parts of the man page, which probably refer to other parts of the man page? – allyourcode May 14 '10 at 3:40
  • 15
    I think you're missing the point that it's important to read the man page to know exactly what you're doing. rsync has some very powerful options, including a way to delete files! It's like your asking for help on using a table saw because you don't like reading instruction manuals. – David M May 14 '10 at 3:53
  • 2
    Of course, I just don't like reading the instruction manual for the 100th time when I can instead refer to a cheatsheet. – CivFan Aug 8 '17 at 16:55

It make sure the permission, attributes, etc. is same at the both side. rsync only works in that way... if you want to synchronising files, you have to use -a parameter.

This is because rsync compare these permission, attribute, etc. at both side to determining if they are the SAME FILE and decide if it should be updated. if you use rsync -r xxx yyy instead rsync -a xxx yyy, some files will be copy again and again, coz, permission, attribute not be synchronised, and miss matched at both side...

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.