Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use the mkdir command to create a folder in Linux

Shulou Source: shulou.com Published: 2022-06-01 16:54:06 10月22日 Update

In this issue, the editor will bring you about how to use the mkdir command to create a folder in Linux. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

I. the right to use the mkdir command

All users can use the mkdir command on the terminal to create a folder or directory in a folder with permissions.

Second, the format of mkdir command

Format: mkdir [options] DirName

Third, mkdir command function

The mkdir command enables you to create a folder or directory named after DirName (the specified file name) at a specified location. The user who wants to create a folder or directory must have write access to the parent folder of the created folder (click here for Linux file-folder permissions). Also, the folder (directory) created cannot have the same name as the file name in its parent directory (that is, the parent folder), that is, it cannot have the same name (case-sensitive) in the same directory.

Fourth, mkdir command options description

There are generally two options in the command:

-m is used to set access to the newly created directory, or it can be set with the chmod command.

-p create an upper-level folder (or directory) when needed, and if the folder (or directory) already exists, it is not considered an error.

5. Examples of using mkdir command

Example 1: create a folder named "it.dengchao.org" under / home/cc/.

Use the following command.

Mkdir / home/cc/it.dengchao.org example 2: create a folder named "it.dengchao.org" under / home/cc/ and assign permissions to the folder, with permissions of 777.

Mkdir 777 / home/cc/it.dengchao.org

This is how to use the mkdir command to create a folder in the Linux shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Files folders commands directories permissions content file name format user analysis upper layer professional medium and small location rich content function size that is articles more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Redmi Linux Shulou Tech Info