CP | MV | RM

Source: Internet
Author: User

Commands for copying, moving, and deleting files in Linux are CP, MV, and RM.

I. file copy command CP command format:

CP [-adfilprsu] source file (source) Destination File (destination) CP [Option] source1 source2 soure3... directory

Parameter description:

-A: Refers to archive, or copying all directories.

-D: if the source file is a link file, copy the properties of the connection file instead of the file itself.

-F: force. If you have repeated or other questions, you will not be asked.

-I: If the destination file (destination) already exists, the system will first ask if the operation is true during overwriting.

-L: Create a hard link connection file instead of copying the file itself.

-P: Copies the object property together, instead of using the default property.

-R: recursive replication for directory Replication

-S: copy it into a symbolic link, that is, a "shortcut" file.

-U: if the target file is older than the source file, update the target file. For example, copy file1 in the/test1 directory to the/test3 directory and change the file name to file2. Run the following command: CP/test1/file1/test3/file2

Ii. File movement command MV command format:

MV [-fiv] source destination

Parameter description:

-F: Force: move directly without asking

-I: If the destination file (destination) already exists, you will be asked whether to overwrite

-U: if the target file already exists and the source file is new, the file will be updated. For example, copy file1 under/test1 to the/test3 directory and change the file name to file2, run the following command: MV/test1/file1/test3/file2

Iii. File Deletion command RM command format:

Rm [FIR] file or directory

Parameter description:

-F: Force Delete-I: interactive mode. Before deletion, ask the user for operations.

-R: recursive deletion. You can run the following command to delete a file1 file in a directory such as/test: Rm-I/test/file1.

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.