The basic mkdir of Linux commands

Source: Internet
Author: User

mkdir What is it?

mkdir is the abbreviation for makedirectories, which is a command to create a directory under a Linux system.

1 , command format:

mkdir [ options ] directory ...

2 , command function:

When the mkdir is followed by a directory name, the new directory is created in the directory that is currently located.

When the mkdir is followed by an absolute path, the new directory is created under the given path directory.

when you create a duplicate directory under the same directory,Linux will prompt Linux to not create it.

Note: The first condition for creating a directory is that You must have access permissions under the destination path where you want to create the directory. mkdir will report this error when you are unable to get permission.

3 , command parameters:

-M,--mode set access rights

with the-m parameter, we can set permissions for the new directory that will be generated.

-P,--parents add a directory containing subdirectories [ Note: Create directories recursively ]

when you want to create a directory that contains subdirectories, you need to use the- p parameter. If mkdir cannot find the parent directory, this parameter first helps to create the parent directory.

-V,--verbose printing process information for creating a directory

if we want to see the information, we can use the -v parameter to implement it.

4 , command instance:

4.1 instance: Creating an empty directory

Command:

mkdir Limin

Output:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/75/5B/wKioL1Y3dXKQ6797AADxXKvjNJI558.jpg "title=" 1.jpg " alt= "Wkiol1y3dxkq6797aadxxkvjnji558.jpg"/>


4.2 Instances: Creating Multiple directories

command:

mkdir zhang3 Li4 Wang5

Output:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/75/5B/wKioL1Y3dlORr95ZAAEKS93dfok344.jpg "title=" 2.jpg " alt= "Wkiol1y3dlorr95zaaeks93dfok344.jpg"/>

4.3 instance: Creating Multiple directories recursively

command:

Mkdir–p Zhang3/li4/wang5

Output:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/75/5D/wKiom1Y3di2Co-pCAAEjCkIzg9g379.jpg "title=" 3.jpg " alt= "Wkiom1y3di2co-pcaaejckizg9g379.jpg"/>

4.4 instance: Create a directory with permissions of 777

command:

Mkdir–m 777 Zhang3

Output:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/75/5D/wKiom1Y3dj7yjw1SAAGrOkv2kBE942.jpg "title=" 4.jpg " alt= "Wkiom1y3dj7yjw1saagrokv2kbe942.jpg"/>

4.5 instance: Creating a catalog Printing process

command:

Mkdir–v Zhang3 Li4 Wang5

Output:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/75/5B/wKioL1Y3do3jR8HCAADDEioHqzk217.jpg "title=" 5.jpg " alt= "Wkiol1y3do3jr8hcaaddeiohqzk217.jpg"/>

This article is from the "Rookie Road" blog, please be sure to keep this source http://2604168.blog.51cto.com/2594168/1708975

The basic mkdir of Linux 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.