[Command Detail] File management

Source: Internet
Author: User

Copy command: CP

CP [OPTION] ... [-T] SOURCE DEST

CP [OPTION] ... SOURCE ... DIRECTORY

CP [OPTION] ...-t DIRECTORY SOURCE ...


CP SRC DEST

src is a file:

If the target does not exist: Creates a new dest and fills the contents of SRC into the dest;

If the directory exists:

If Dest is a file: overwrites the contents of SRC into the dest;

It is recommended to use the-I option for the CP command;

If Dest is a directory: Create a new file with the same name as the original file under Dest, and populate the contents of SRC with the new file;


CP SRC ... DEST

SRC ... : Multiple Files

dest must exist and be directory, other situations will be error;


CP SRC DEST

src is the directory:

use option at this time:-R


If Dest does not exist: creates the specified directory and copies all files in the SRC directory to dest;

if dest exists:

If Dest is a file: Error

If Dest is a directory:


Common options:

-I: Interactive

-R,-r: recursively copy directories and all internal content;

-A: archive, equivalent to-DR--preserv=all

-d:--no-dereference--preserv=links

--preserv[=attr_list]

Mode: Permissions

ownership: Belong to the main group

Timestamp:

Links

xattr

Context

All

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

-V:--verbose

-F:--force


Mv:move, moving files

MV [OPTION] ... [-T] SOURCE DEST

MV [OPTION] ... SOURCE ... DIRECTORY

MV [OPTION] ...-t DIRECTORY SOURCE ...

Common options:

-I: Interactive

-F: Mandatory


Rm:remove, deleting

rm [OPTION] ... FILE ...


Common options:

-I: Interactive

-F: Force delete

-R: Recursive


RM-RF


[Command Detail] File management

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.