Common tools for file management in Linux

Source: Internet
Author: User

Common Tools for file management: CP, MV and RM
Copy command: CP (copy)
Use format:

                            cp [OPTION]... [-T] SOURCE DEST                            cp [OPTION]... SOURCE... DIRECTORY                            cp [OPTION]... -t DIRECTORY SOURCE...    简述            1、当SOURCE是一个文件时                    如果DEST不存在时,则新建文件,并把SOURCE中的内容填充到新

File, when dest exists and is a file, the file is overwritten if dest is an eye-

folder, the file is placed in the directory.

           2 、当SOURCE是多个文件时                     如果DEST不存在,则报错,当DEST存在且为一个文件时也报错,当

When Dest is a directory, all the files in the source are placed in that directory.

         3、当SOURCE是一个目录时,要配合-r选项                    当DEST不存在时,则创建指定名称的目录,并将SOURCE中的所有文

Copy to the newly created specified directory. When Dest exists and is a file, an error occurs. When

When a dest exists and is a directory, the contents of two directories are merged, and if there is a file with the same name, the

Files in the source directory overwrite files in the Dest directory.

Common options

                     -I: Interactive prompt On overlay-r: Recursively copy all contents of directory and directory-D: When not added-D                                                            , the copy soft link will copy the content from the source, plus the-D to keep the link property, copy the soft link past--preserve= Property list                                                            Mode: Indicates permission invariant Owner[ship]: Indicates permission and the owner and the group are unchanged                                                            Time: three timestamp unchanged                                                            Xattr: Indicates ACL permissions are not changed Links: Indicates that the link is unchanged                                                            Context: Indicates that the security context of the file does not change                     All: Represents all of the above properties-P: means to keep the properties of the original file-A: Represents the archive, equivalent to-RDP -V: Shows the replication process-F: Force overwrite: When a normal user is not able to change the target file, but has permission to create and delete files in the directory where the target file resides, use-F can be used to force the overwrite.           Delete the file before creating it.             -U; Overwrite the source only the old file is renamed to the file name before the new file--backup-numbered overwrite the target file. Digital

Move command: MV

             使用格式:                           mv [OPTION]... [-T] SOURCE DEST                           mv [OPTION]... SOURCE... DIRECTORY                           mv [OPTION]... -t DIRECTORY SOURCE...

When the source is a file, the target does not exist The Times error is as follows:

mv:missing destination file operand after ' F2 '
Try ' MV--help ' for more information.
When the target is present and is prompted for overwrite when the target is a directory, the source file is moved to the directory

In
When the source is multiple files, the target file times are wrong as follows:
   
Mv:target ' T1 ' is not a directory
When the target is a directory, multiple source files are moved to that directory.

When the source is a directory, the target does not exist The Times error is as follows:
mv:missing destination file operand after ' T7 '
Try ' MV--help ' for more information.
When the target exists and is a directory, the source directory is moved to that directory. When the target for file times is wrong as follows:
Mv:overwrite ' passwd '? Y
Mv:cannot overwrite non-directory ' passwd ' with directory ' T7 '

When the source is multiple directories, multiple directories of the source are moved to that directory.

Delete command: RM

                  使用格式:  rm [OPTION]... FILE...

    
Common options:

             -i 交互式             -f 强制删除             -r 递归删除                                                  

Common tools for file management in Linux

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.