Linux command mkdir detailed explanation and example demonstration
In the Linux system, the mkdir
command is used to create directories and is highly flexible and practical. sex. Through the mkdir
command, users can quickly create a directory structure to facilitate management of files and data. This article will introduce the use of the mkdir
command in detail and give specific code examples to demonstrate its functionality.
mkdir
Command introductionmkdir
is the abbreviation of "make directory" in English and is used to create a new directory. Its basic format is:
mkdir [option] directory name
mkdir
Common options for the command-m
: Specify the permissions for the new directory, the default is 777
-p
: Create directories recursively, that is, you can create multi-layer directories at once mkdir
Command example demonstrationmkdir mydir
The above command will create a directory named Is the new directory of mydir
.
mkdir -p mydir1/mydir2/mydir3
The above command will recursively create the mydir1
directory and recursively create it in it mydir2
directory, and then recursively create the mydir3
directory in mydir2
.
mkdir -m 755 mydir
The above command will create a new directory with permissions 755
mydir
.
mkdir dir1 dir2 dir3
The above command will create dir1
, dir2
,# at the same time ##dir3Three directories.
my directory, which can be passed Use single or double quotes to handle directory names with spaces.
mkdir command. It can create directory structures quickly and easily, helping us better manage files and data. In daily Linux system management, the
mkdir command is an essential tool. I hope this article will help you understand and master the
mkdir command.
The above is the detailed content of Detailed explanation and example demonstration of Linux command mkdir. For more information, please follow other related articles on the PHP Chinese website!