Get the App
SLTechnology News&Howtos  ›  Servers  › 

Create a directory using the mkdir command of linux

Shulou Source: shulou.com Published: 2022-06-02 18:40:35 09月22日 Update

Editor to share with you the use of linux mkdir command to create a directory, I hope you will learn a lot after reading this article, let's discuss it together!

The mkdir command is an abbreviation for "make directories" and is used to create directories.

Note: by default, if the directory you want to create already exists, the prompt already exists and does not continue to create the directory. So when creating a directory, make sure that the newly created directory does not have the same name as the files in its directory. The mkdir command can also create multiple directories at the same time, isn't it powerful?

Syntax format: mkdir [parameters] [directory]

Common parameters:

-p Recursive create multi-level directory-m set the permissions of the directory while establishing the directory-z set the security context-v display the creation process of the directory

Reference example

Under the working directory, create a subdirectory called dir:

[root@linuxcool ~] # mkdir dir

Create a subdirectory dir under the directory / usr/linuxcool, and the file owner has read, write and execute permissions, but no one else has access to it.

[root@linuxcool] # mkdir-m 700 / usr/linuxcool/dir

Create a subdirectory dir1,dir2,dir3 at the same time:

[root@linuxcool ~] # mkdir dir1 dir2 dir3

Recursively create a directory:

[root@linuxcool] # mkdir-p linuxcool/dir has finished reading this article. I believe you have some understanding of creating a directory using linux's mkdir command. You want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!

Tags: Directories commands at the same time subdirectories subdirectories parameters files permissions articles recursion power security up and down context multiple finished instances commonly used places more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information vpn OPPO Reno MariaDB