CentOS System File and folder actions (new, delete, move)

Source: Internet
Author: User
Tags mkdir centos


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 at home

1 vi/home/test.sh

3. delete files or folders

Delete the test directory in the home directory

1 rm/home/test

This method of deleting without parameters often prompts you not to delete because permissions are not sufficient.

1 Rm-r/home/test

-R is the directory and its subdirectories in a recursive delete parameter table. The directory will be emptied and deleted. The user is usually prompted when deleting a write-protected file contained in a directory.

1 rm-rf/home/test

-F is to delete all files under the directory without prompting the user. Please note that checking the path, the loss of a different directory is tragic.

1 rm-ir/home/test

-I is the 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 an overwrite of an existing target file, the system asks if it is rewritten, asking the user to answer "y" or "n" to avoid overwriting the file incorrectly.

-F: Disables interaction. If the MV operation is to overwrite an existing target file without giving any indication, the I parameter will no longer function when this parameter is specified.

5. copy files or folders

CP [Options] source file (source) purpose? n (destination)

Parameters:

-A: equivalent to the meaning of-pdr;

-D: If the source file is a link file attribute (link file), then copy the link file attribute instead of the file itself;

-F: For the purposes of coercion (force), if there are duplicates or other questions, the user will not be asked and forced to copy;

-I: If the purpose N (destination) already exists, the overwrite will ask whether the real action!

-L: The link file of the hard link (hard link) is established rather than copying the file itself;

-P: Copies the past along with the attributes of the file, rather than using the preset attributes;

-R: Recursive continuous replication, for directory replication behavior;

-S: Copy to a symbolic link file (symbolic link), or "shortcut" file;

-U: If destination is newer than source destination!

Finally note that if the source file has more than two, then the last destination document must be "directory" to do!

Related Article

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.