What are the file management class commands on Linux, their common use methods, and their associated example demos.
Copy command: CP
CP [OPTION] ... [-T] SOURCE DEST
CP [OPTION] ... SOURCE ... DIRECTORY
CP [OPTION] ...-t DIRECTORY SOURCE ...
CP SRC DEST
SRC is a file:
If the target does not exist: Create a new dest and populate the SRC content into dest
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/89/B5/wKiom1gaiATyokW3AAAapBwZHy8471.png-wh_500x0-wm_3 -wmp_4-s_2426293894.png "title=" 1.png "alt=" Wkiom1gaiatyokw3aaaapbwzhy8471.png-wh_50 "/>
If the directory exists:
If Dest is a file: overwrites the contents of SRC into the dest;
It is recommended to use the-I option for the CP command;
If Dest is a directory: Create a new file with the same name as the original file under Dest, and populate the contents of SRC with the new file;
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/89/B5/wKiom1gaifjgJJS9AAAnFFr7Cgg583.png-wh_500x0-wm_3 -wmp_4-s_2572730160.png "title=" 1.png "alt=" Wkiom1gaifjgjjs9aaanffr7cgg583.png-wh_50 "/>
CP SRC ... DEST
Src... : Multiple Files
Dest must exist and be directory, other situations will be error
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/89/B3/wKioL1gai83yc9hqAABb_egOCeg851.png-wh_500x0-wm_3 -wmp_4-s_1535668733.png "title=" 1.png "alt=" Wkiol1gai83yc9hqaabb_egoceg851.png-wh_50 "/>
CP SRC ... DEST
Src... : Multiple Files
Dest must exist and be directory, other situations will be error;
CP SRC DEST
SRC is the directory:
Use option at this time:-R
If Dest does not exist: creates the specified directory and copies all files in the SRC directory to dest;
If dest exists:
If Dest is a file: Error
If Dest is a directory:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/89/B9/wKiom1gayw3wwQfOAABErWs0cJU596.png-wh_500x0-wm_3 -wmp_4-s_1673626072.png "title=" 1.png "alt=" Wkiom1gayw3wwqfoaaberws0cju596.png-wh_50 "/>
Common options:
-I: Interactive
-R,-r: recursively copy directories and all internal content;
-A: Archive, equivalent to-dr–preserv=all
-d:–no-dereference–preserv=links
–preserv[=attr_list]
Mode: Permissions
Ownership: Belong to the main group
Timestamp: Time stamp
Links link
Xattr Extended Properties
Context Security Contexts
All above
-p:–preserv=mode,ownership,timestamp
-v:–verbose
-f:–force
Linux-text-1 CP Command