CentOS New, delete, move, copy commands

Source: Internet
Author: User

1. Create a new Folder

mkdir file name

Create a new folder named Test under Home

1 Mkdir/home/test

2. New text

Create a new test.sh script under Home

1 vi/home/test.sh

3. Delete a file or folder

Delete the test directory under the home directory

1 Rm/home/test

This method of deleting without parameters often prompts that it cannot be deleted because of insufficient permissions.

1 Rm-r/home/test

-R is a recursive delete parameter in the table of directories and their subdirectories. The directory will be emptied and deleted. When you delete a directory that contains a write-protected file, the user is usually prompted.

1 Rm-rf/home/test

-F is to not prompt the user to delete all files under the directory. Please note that it is tragic to check the path and enter into another directory.

1 Rm-ir/home/test

-I is an interactive mode. With this option, the RM command prompts the user for confirmation before deleting any files.

4. Move a file or folder

MV [options] source file or directory destination file or directory

Parameters:

-I: Interactive mode operation. If the MV operation will result in overwriting an existing target file, then the system asks whether to overwrite it, asking the user to answer "y" or "n", which avoids overwriting the file by mistake.

-F: Disables interactive operation. MV operation to overwrite an existing target file without giving any indication, after specifying this parameter the I parameter will no longer work.

5. Copying files or folders

CP [Options] source files (source) destination files (destination)

Parameters:
-A: equivalent to the meaning of-pdr;
-D: If the source file is the attribute of the link file, the link file attribute is copied instead of the file itself;
-F: For force, if there is any duplication or other doubt, the user will not be asked, but forced to copy;
-I: If the destination file (destination) already exists, the overwrite will ask if the action is true!
-L: The link file for the hard link is established, not the copy file itself;
-P: Copy the past together with the attributes of the archive, rather than using the default attributes;
-R: Recursive continuous replication, used for directory replication behavior;
-S: Copy as a symbolic link file (symbolic link), i.e. "shortcut" files;
-U: Update destination If destination is older than source!
Finally, note that if the source file has more than two, then the last destination file must be "directory"!

CentOS New, delete, move, copy commands

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.