The mkdir-command uses

Source: Internet
Author: User
Tags create directory

mkdir: Command

1. Detailed command

"Feature description"

The mkdir command is a combination of the bold letters of each word in make directories, and its function is to create a directory, which, by default, prompts if the directory you are creating already exists, and does not continue to create the directory

"Syntax format"

  

  

mkdir [option] [Directory]
Mkdir Options Directory

"Option description"

Explanation of parameter options (with Δ emphasis)
-P
Recursively creates a directory that recursively means a subdirectory of the parent directory and its subdirectories Δ
Even if the directory implementation you want to create already exists, you will not be able to indicate that the directory already exists
-m set permissions for the default directory of the newly created directory
-V shows the process of creating a directory
2. Use case

1. Basic examples

Case 1, create a directory usage example without using any command parameters.

Let's start by looking at the current directory tree structure, with the following command:

[[Email protected] ~]# CD
[Email protected] ~]# tree-d
. #根据结果可以看出当前目录下没有任何目录

0 Directories

Start the test to create the directory and check:

[[email protected] ~]# mkdir data #在当前目录下创建data目录, where data is a relative path
[Email protected] ~]# tree-d
.
└──data #可以看到data目录已经创建.

1 directory
[Email protected] ~]# mkdir data #再次执行创建命令会提示目录已经存在.
mkdir: Unable to create directory "data": File already exists

Extended Knowledge:

The directory path style under Windows is d:\data\test, and the path style under Linux is/data/test, and their directory vertices and separators are different.

Case 2: Creating a directory recursively using the-p parameter

When we create a multilevel directory, if the first level directory (cc) does not exist, then we create the results will be error, resulting in the creation of results, the operation is as follows:
[Email protected] ~]# mkdir cc/test
Mkdir:cannot Create directory ' cc/test ': No such file or directory #提示没有这个文件或目录

At this point, you can specify the-p parameter to recursively create a multilevel directory:

The mkdir-command uses

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.