cp -p Command: Copy Files & Directories Preserving Permissions
The 'cp -p' command is used to copy files or directories while preserving their original file permissions and ownerships. The '-p' option stands for 'preserve' and is used to ensure that the copied files or directories retain the same attributes as the original ones.
Example usage:
To copy a file called 'myfile.txt' while preserving its permissions and ownership, use the following command:
cp -p myfile.txt /path/to/new/location/
This will create a copy of 'myfile.txt' in the specified location with the same permissions and ownership as the original.
Note: The '-p' option is often used in combination with other options such as '-r' for recursive copying of directories.
原文地址: https://www.cveoy.top/t/topic/odvV 著作权归作者所有。请勿转载和采集!