Use of the CP,RM,MV command on the Linux command line

Source: Internet
Author: User

The following content is from "Bird's private Cuisine"

Copy, delete, and move under the Linux command line: CP,RM,MV

CP (COPY) replication

CP This command is used many, in addition to simple replication, you can also create a link file compared to two of the old and new files to be updated,

and copying the entire directory, etc.

Grammar

CP [-ADFILPRSU] source file destination file

source file (sources)

Target file (destination)

Options

-A: equivalent to the meaning of-pdr, please refer to the following article

-D: If the source file is a property of a linked file, the linked file property is copied instead of the file itself

-F: Mandatory means (force), that is, overwrite the existing file



RM (remove) Delete

Grammar

RM [-rfi] File or directory

Options

-R: Recursive operation

-F: Mandatory (force)

-I: Prompt message when deleting

This rm-rf file/dir This command is very dangerous, unless very certain,

Otherwise it is recommended to add the I option


Note: You should do this when a file starts with a--

#rm-RF---filename-

Precede the file name with--

Or specify a file under a directory, such as

#rm-RF./-filename-



MV (move) Move file or directory, rename

Grammar

MV [-finu] source destination

MV [-finu] Source ... directory

Options

-F: If the target file exists, it will be overwritten

-I: Prompt information

-N: If the target file exists, does not overwrite

-U: Update if the source file is newer than the target file, or if the destination file is missing, otherwise not updated

In the same directory, the MV also has the function of renaming

# MV ABC CBA



Use of the CP,RM,MV command on the Linux command line

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.