Linux File management tools: CP, MV, RM
1, Cp:copy
Source file: Destination file
Single source copy: CP [OPTIONS] ... [-T] SOURCE DEST
If the dest (target) does not exist, the data stream is created and copied to the target file;
Eg: Copy the etc/passwd to/tmp/passwd.bak and the destination file does not exist, so it will be created automatically Passwd.bak
cp-v/etc/passwd/tmp/passwd.bak
if DEST (target) exists, then overwrite the target file;
Eg: the destination file is overwritten because the destination file already exists.
cp-v/etc/passwd/tmp/passwd.bak
Multi-source replication: CP [OPTION] ... SOURCE ... DIRECTORY
CP [OPTION] ...-t DIRECTORY SOURCE ...
If the dest does not exist: error;
if dest exists:
If Dest is a non-directory file: error;
if Dest is a directory file: Copy each file to the target directory separately and keep the original original;
Common options:
-I: Interactive replication, that is, before overwriting to remind users to confirm;
- F: Force overwrite the target file;
-R,-r: Recursive copy directory;
-D: Copies the symbolic link file itself, not the source file it points to;
-a:-dr--preserve=all, archive, for archiving;
--preserv=
Mode: Permissions
ownership: A group of owners and genera
timestamps: Time stamp
Context: Security label
xattr: Extended Properties
Links : Symbolic links
all: All of the above properties
2. MV Command: Move
MV [OPTION] ... [-T] SOURCE DEST
MV [OPTION] ... SOURCE ... DIRECTORY
MV [OPTION] ...-t DIRECTORY SOURCE:
Common options:
-I: interactive;
-f:force
3. RM Command: Remove
RM [OPTION] ... FILE ...
Common options:
-i:interactive
-f:force
-r:recursive
Delete directory: Rm-rf/path/to/dir
Hazardous operation: RM-RF/*
Linux File management Tools