Linux basic Commands (iv)--file management

Source: Internet
Author: User

cp:copy
CP SRC DEST
-R Recursive replication
-I interactive Tips
-F forcibly overwrite
-P Maintain original properties (ownership timestamp)
-A: Archive replication, often used for backups (keep all attributes of the file)
-P: Copy is link generated is the link
-D: Keep links

Copy command
Only one file to one file
Multiple files to a directory
A file to a directory
EG1: cp/etc/{passwd,inittab,rc.d/rc.sysinit}/tmp/copy three files to the TMP directory
EG2: cp/etc/passwd/tmp/Copy the passwd to the TMP directory
eg3: cp/etc/passwd/tmp/test
If the test is a directory, it is copied to the test directory, and if it is a file, overwrite the file and rename it to test.
cp/etc/init.d//tmp/hello can copy directories to a directory that is not created
The target of replication is only one, and the source can have multiple
If there are multiple sources, the target can only be a directory

Mv:move Moving files

MV SRC DEST
Mv-t DEST SRC
MV name rename files and directories can be renamed
EG1: [Email protected] tmp]# MV/TMP/ROOT.INITTAB/VAR/TMP/ABC
If ABC does not exist, rename the file to ABC, and if present, overwrite and rename ABC; If ABC is a directory, move the file to the ABC directory
EG2: [Email protected] tmp]# mv/tmp/hello//VAR/TMP/ABC
If ABC exists and is a directory, it is to move the Hello directory to the ABC directory, if ABC does not exist, it is to move the Hello directory to/var/tmp and renamed to ABC

Install: Copying files and Setting properties
-D direcotry ... : Creating a Directory
SRC DEST can only copy files
-M can specify permissions
Install-t DIRECTORY SRC ...

This article is from the "Sailing" blog, be sure to keep this source http://it6789.blog.51cto.com/6971671/1709372

Linux basic Commands (iv)--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.