CP (copy)
The CP command can copy files or directories, and can also create linked files.
[[email protected] ~]# CP [-ADFILPRSU] source file (source) destination file (destination) [[email protected] ~]# CP [Options] Source1 source2 s Ource3. Directory-r,-R,--recursive copy directories recursively-p same As--preserve=mode,ownership,timestam Ps-a,--archive same as-dr--preserve=all [can keep linked files], generally only root execution
To copy a file :
# CP a B C D # What does that mean? Source:a b C, destination:d, copy a b c to directory D
# cp/etc/a.txt/tmp/b
If B is a directory: Copy the a.txt to the B directory
If B is a file:
If B does not exist, copy the a.txt and rename it to B
If b exists, indicates whether to overwrite
To copy a directory :
# cp/etc/tmp
Cp:omitting directory '/etc '
# cp-r/etc/tmp # Copy directory needs to use the-r recursion option
To copy a hidden file :
With CP */tmp How can I copy the hidden files together in this type of operation?
We can only copy all non-hidden files by playing this command above. The reason for this is:(wildcard characters cannot match the file name with "." Files that begin with)
# cp-a. /tmp # Right
# CP. */tmp # just copy hidden files
MV (move)
The MV command is typically used to move files and rename them.
# mv/etc/somedir/tmp/somefile # error, cannot use directory to overwrite file
# mv/etc/somedir/tmp/somedir # Yes
RM (remove)
The RM command is used to delete files and directories. With it the basic will not use rmdir this again.
RM-RF Command Usage rules:
1, in the production environment, do not always log on as the root user
2, operation, than is slow and careful, not fast, press ENTER before you must repeatedly check
3, the key business operations, it is best to find a colleague in the side to see, testify
4. Turn on the analog terminal software logging function
This article is from the "Share Your Knowledge" blog, so be sure to keep this source http://skypegnu1.blog.51cto.com/8991766/1934756
Linux Common commands: CP,MV,RM