Reputation: 51
What is the difference of cp -p and cp -a in UNIX?
Hi Everyone, by seeing the subject you'll have an idea what I wanted to know but before that, if you know any emulator or site where I can put in my command to test please let me know so I can do it first on my own. I would like a UNIX test environment given the fact that I don't have a UNIX environment setup on my laptop. Thank you!
Upvotes: 2
Views: 2458
Reputation: 4360
With the -p
option, the copy has the same modification time, the same access time, and the same permissions as the original. It also has the same owner and group as the original, if the user doing the copy has the permission to create such files.
The -a
option means -R
and -p
, plus a few other preservation options. It attempts to make a copy that's as close to the original as possible: same directory tree, same file types, same contents, same metadata (times, permissions, extended attributes, etc.).
Upvotes: 3