1. CP command for copying files or directory format: cp[options] Source file destination file
There are three ways to replicate a directory:
@1, the target file is a directory, the source is copied to the directory;
@2, the target file is a file that overwrites the file with the source file;
@3, file file does not exist, the source file will be copied and modified to the name of the target file;
equivalent to-PDR (P,d,r for the above parameters)
CP Command Parameters
parameter |
function |
-p |
Preserve the original file's properties |
-d |
If the object is "Connection file", leave the "Connection file" property |
-r |
recursive continuous replication |
-i |
if the destination file exists, ask whether to overwrite |
-a | Td>
For example: Create a file named Install.log
Touch Intall.log
Copy Install.log to Xxx.log
CP -ai xxx.log 111. Log
2, MV command for moving files or renaming format: mv[options] File name [destination file path] [target filename]
Rename file AAA to BBB
MV AAA BBB
3, rm command to delete files or directories, format: "rm[Options" File "
Delete normal files and prompt for confirmation: "RM file name"
Delete normal file or directory file, do not prompt: "RM-RF file or directory"
RM command
Parameters |
Role |
-F |
Ignore warnings |
-I. |
Ask before deleting |
-R |
Delete a folder |
4. DD command is used to specify the size of the copied file or to specify the converted file in the format: dd "parameter"
DD parameter
Parameters |
Role |
If |
The file name entered |
Of |
The file name of the output |
Bs |
Set the size of each "block" |
Count |
Set the number of "blocks" to copy |
Conv=ucase |
Convert letters from small to uppercase |
Conv=lcase |
Convert letters from uppercase to lowercase |
LINUX-14 Basic command-copy (CP) move (MV), delete (RM), copy file (DD)