Linux Command - cp
cp - copy files and directories
cp test1.txt test2.txt
cp test1.txt dir1
cp test1 test2 dir1
cp --attributes-only -p test1.txt test2.txt
-r | recursive |
-R | also recursive |
-a | archive, same as -dR –preserve=all |
–attributes-only | just copy attributes, not file data, need to combine with -p |
-b | backup each destination file first |
-f | if file exists and can’t be opened, remove and replace |
-i | prompt to overwrite |
-l | create hard link instead of copying |
-s | create sym link instead of copying |
-n | no clobber, don’t overwrite existing file |
-p | perserve mode, ownership, timestamps |
–preserve=LIST | specify what to preserve, default: mode,ownership,timestamps, other options: context, links, xattr, all |
–no-preserve=LIST | what not to preserve ( see preserve ) |
-u | only copy if source is newer than dest |
-v | verbose |
-Z | set SELinux security context to default type on dest |
-d | preserve links |