Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I use -p to preserve the file permissions of a file being copied, does it apply to the source or the destination file (if it already exists)?

Thanks

share|improve this question

1 Answer 1

up vote 4 down vote accepted

It's preserves the source file's attributes (mode, ownership, and timestamps) in the destination. (Provided the destination file system supports it.)

If a file already exists it will be overwritten with the source and it's attributes, unless you've combined the -i flag.

share|improve this answer
    
exhausting and 100% correct. –  yarek Jan 19 '12 at 22:11
    
So if -p is not specified and the destination file exists, the copied file will inherit the mode and owner of the existing file? –  Tom Jan 19 '12 at 23:02
    
Yes, that's correct. :) –  Aaron Copley Jan 20 '12 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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