Linux Common Basic command mkdir

Source: Internet
Author: User

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/75/4C/wKioL1Y1t5yj2oELAAIMAZ0vr3A472.jpg "title=" Mkdir.jpg "alt=" Wkiol1y1t5yj2oelaaimaz0vr3a472.jpg "/>

mkdir Create a directory or folder


  • command function:mkdir (make directory) creates a directory or folder, and the created user needs to have write permissions in the current directory. Use the mkdir command to create the specified directory or folder name, and the specified directory name cannot be a directory that is already in the current directory. The same directory cannot have the same name ( case Sensitive ).  

  • Command format:

[[email protected] ~] #mkdir "Options" Directory name

    • Command parameters:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/75/4C/wKioL1Y1umCRET3qAAGRy0am6TE466.jpg "title=" mkdir command parameter. jpg "alt=" wkiol1y1umcret3qaagry0am6te466.jpg "/>

    • Command instance:

Example 1: Create an empty directory

[[email protected] test] #mkdir test1[[email protected] test]# ls-ltotal 4drwxr-xr-x. 2 root root 4096Nov 1 14:09 test1[[email protected] test]#

Example 2: Creating a multi-tiered catalog

[Email protected] test]# mkdir-p test2/test22[[email protected] test]# ls-ltotal 8drwxr-xr-x. 2 root root 4096Nov 1 14:09 test1drwxr-xr-x. 3 root root 4096Nov 1 14:15 test2[[email protected] test]# CD Test2/[[email protected] test2]# ls-ltotal 4drwxr-xr-x. 2 root root 4096Nov 1 14:15 test22[[email protected] test2]#

Example 3: Create a directory with permissions of 777

[Email protected] test]# mkdir-m 777 Test3[[email protected] test]# ls-ltotal 12drwxr-xr-x. 2 root root 4096Nov 1 14:09 test1drwxr-xr-x. 3 root root 4096Nov 1 14:15 test2drwxrwxrwx. 2 root root 4096Nov 1 14:18 test3[[email protected] test]#

Description: The test3 permission is rwxrwxrwx


Example 4: Creating a new directory displays information

[Email protected] test]# mkdir-v test4mkdir:created directory ' test4 ' [[email protected] test]# MKDIR-VP test5/test5-1m kdir:created directory ' test5 ' mkdir:created directory ' test5/test5-1 ' [[email protected] test]#

Example 5: A command to create a directory structure for a project

[[Email protected] test]# mkdir -vp abc/{a/,b/,c/{e,f},123/{1,2},ser/dep/{h,k}}mkdir:  created directory  ' abc ' mkdir: created directory  ' abc/a/' mkdir: created  directory  ' abc/b/' mkdir: created directory  ' abc/c ' mkdir: created directory   ' abc/c/e ' mkdir: created directory  ' abc/c/f ' mkdir: created directory  ' abc/ 123 ' mkdir: created directory ' ABC/123/1 ' mkdir: created directory ' ABC/123/2 ' mkdir:  created directory  ' abc/ser ' mkdir: created directory ' ABC/SER/DEP ' mkdir: created  Directory ' abc/ser/dep/h ' mkdir: created directory ' abc/ser/dep/k ' [[email protected] test]#  tree abc/abc/├── 123│   ├── 1│   └── 2├── a├──  b├── c│   ├── e│   └── f└── ser   └──  dep        ├── h        └── k 12  directories, 0 files[[email protected]]#


This article is from the "Ln_linux" blog, make sure to keep this source http://lnlinux.blog.51cto.com/1331535/1708533

Linux Common Basic command mkdir

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.