Cp mv command summary, cpmv command

Source: Internet
Author: User

Cp mv command summary, cpmv command

Use the cp command:

Function Description: Copy files and directories

Syntax:

Cp [OPTION]... [-T] SOURCE DEST
Cp [OPTION]... SOURCE... DIRECTORY
Cp [OPTION]...-t directory source...

Explanation: 1) if the SOURCE object does not exist for a single file, create a new DEST and copy the content in the SOURCE object to the DEST object.

Target exists. DEST is a file that overwrites the DEST content.

DEST is the directory, and the same file name and content as SOURCE are created.

2) SOURCE separates the target from multiple files by commas (,). The DEST must be a directory.

3) If SOURCE is a directory (the-r option must be used) and the target is a file, an error is reported.

The target directory does not exist. Create a New DEST and copy the content in SOURCE to DEST.

The target directory exists. Create the same directory name as SOURCE and copy the content in SOURCE to DEST.

4) When copying a directory, the SOURCE directory name does not contain "/"

Common options:

-I: Interactive, used for DEST and SOURCE replication with the same name

-R,-R: recursively copy the Directory and all its contents

-A: Archive, equivalent to-dR -- preserve = all

-D: -- no-dereference -- preserv = links

-- Preserv = [ATTR_LIST]

Mode: Permission

Ownership: Owner Group

Timestamp

Links

Xattr

Context

All

-P: -- preserv = mode, ownership, timestamp

-V: -- verbose: displays the running progress.

-F: -- force is used when the target file cannot be opened.

-S: Create a symbolic link

-L: Create a hard link. Note: it cannot be used to create a directory.

-P: -- no-dereference. SOURCE is a symbolic link, which is also a symbolic link after replication.

-L: opposite to-P

-U: copy when SOURCE is updated than DEST.

-- Backup = [control]: Creates a backup file. If a file with the same name exists in the target directory, it is overwritten by default.

None, off: never backed up

Numbered, t: Back up by serial number

Existing. nil: If the serial number Backup exists, use the serial number backup. Otherwise, use the simple backup.

Simple, never: simple backup (~) at the end of the file name (~))

-- Remove-destination: delete a file before copying a file with the same name in the target file.

 

Mv command:

Function Description: Move and rename a file.

Syntax:

Mv [OPTION]... [-T] SOURCE DEST
Mv [OPTION]... SOURCE... DIRECTORY
Mv [OPTION]...-t directory source ..

Explanation: 1) SOURCE is a file, and DEST is a file. Rename the file.

DEST is a directory. Copy the source file to DEST.

2) When multiple files exist in SOURCE, separate the target with spaces. The DEST must be a directory.

3) If SOURCE is a directory and the target directory does not exist, modify the directory name.

The target directory exists. Move SOURCE to DEST.

 

Common options:

-I: Interactive, used for DEST and SOURCE replication with the same name

-F: Force Overwrite

-V:

-U: moved when SOURCE is updated than DEST.

-N: Moving objects is not allowed to overwrite existing objects.

-B: create a backup file. If a file with the same name exists in the target directory, it is overwritten by default.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.