Page 1 of 1

cp flags question

Posted: 2018/07/19 20:33:01
by stevesdl
When copying a user's files on same partition\filesystem:

What is the difference between cp -af and cp -rpf?

From my understanding and man pages -a keeps all file settings including ownership, permissions,sl and includes recursive.

Why use -rp when it is covered in -a?

thanks ahead of time

Re: cp flags question

Posted: 2018/07/20 02:22:38
by stevesdl
Okay? might they be the same?

Re: cp flags question

Posted: 2018/07/20 04:35:28
by aks
From man cp:

-a, --archive
same as -dR --preserve=all
-d same as --no-dereference --preserve=links
-f, --force
if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used)
-R, -r, --recursive
copy directories recursively
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all