Linux system management_topic 02: manage files (1)_2.3 copy, cut, delete and create files_cp_mv_rm

 

Usage: cp [options]... [-T] source file object file

or: cp [options]...source file...directory

or: cp [options]... -t directory source files...

Copy a source file to a target file, or copy multiple source files to a target directory.

 -f remove the target file if it cannot be opened and try again

 -i ask before overwriting (disables -n option)

 -l only creates hardlink files without copying files

 -n do not overwrite existing files (disables -i option)

 -p preserve file access, owner, filegroup and timestamp when copying

 -R recursively copies all contents of a directory and its subdirectories

 -s only creates symlinks without copying files

 -u Copy only if the source file is newer than the target file, or if the target file does not exist

 

Usage: rm [options]... file...

Delete (unlink) the file.

 -f Force delete. Ignore non-existing files without prompting for confirmation

 -i require confirmation before deleting (default option)

 -R recursively delete directories and their contents

 

mv does not have the -R option, mv can move directories directly.

Usage: mv [options]... [-T] source file target file

or: mv [options]...source file...directory

or: mv [options]... -t directory source files...

Rename the source file to the target file, or move the source file to the specified directory.

 -f do not ask before overwriting

 -i Ask before overwriting

 -n do not overwrite existing files

 -u move only if the source file is newer than the target file, or if the target file does not exist

If more than one of -i, -f, -n is specified, only the last one takes effect.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325055783&siteId=291194637