Home >System Tutorial >LINUX >What command to create a directory in linux
The command to create a directory in Linux is mkdir, and the syntax is: mkdir [option] directory name. Options include: -p creates a parent directory; -v outputs detailed information; -m sets permission mode. Examples: mkdir foo creates the foo directory; mkdir -p /tmp/bar creates the /tmp/bar directory even if /tmp/ does not exist; mkdir -m 777 example creates the example directory with permissions 777.
The command to create a directory in Linux: mkdir
The mkdir command is used to create a directory (folder) in Linux )The command. The syntax is simple:
<code>mkdir [选项] 目录名</code>
where options are optional and directoryname is the name of the directory you want to create.
Options:
-p
: Creates all necessary parent directories. For example, to create the /tmp/foo/bar
directory if /tmp/foo
does not exist, use mkdir -p /tmp/foo/bar
. -v
: Output the details of the created directory. -m mode
: Set the permission mode of the directory. For example, mkdir -m 755 foo
will create the foo
directory with permissions 755. Example:
Create a directory named foo
:
<code>mkdir foo</code>
Create a directory named bar
even if the parent directory does not exist:
<code>mkdir -p /tmp/bar</code>
Create a directory named example
directory with permissions 777:
<code>mkdir -m 777 example</code>
Note:
The above is the detailed content of What command to create a directory in linux. For more information, please follow other related articles on the PHP Chinese website!