Copy, move, and delete files in Linux

Source: Internet
Author: User

commands for copying, moving, and deleting files in Linux are CP, MV, and RM.
1. File Replication command CP
Command Format: CP [-adfilprsu] source file (source) Destination)
CP [Option] source1 source2 sourc4... directory
parameter description:
-A: indicates the meaning of 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 there are duplicates or other questions, if the target file (destination) already exists, force copy does not ask the user.
-I: If the target file (destination) already exists, the system will first ask whether the operation is true during overwriting.
-l: create a hard link file, instead of copying the file itself
-P: copy the file with its properties, rather than using the default properties
-R: recursive copy, used for directory replication
-S: Copy to symbolic link, that is, a "shortcut" file
-u: if the target file is older than the source file, update the target file
if you copy file1 under/test1 to/test3 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, force direct movement without asking
-I: If the destination file (destination) already exists, it will ask whether to overwrite
-u: If the destination file already exists, the source file is updated.
if you copy file1 in the/test1 directory 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, often used in directory Deletion
To delete the file1 file under the/test directory, run the following command:
Rm-I/test/file1

From: http://www.lupaworld.com/home-space-do-blog-uid-408170-id-149537.html

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.