The mkdir command in Linux is used to create directories in the Linux operating system. Syntax: mkdir [options]
. Options include: -p: create directories recursively; -m: set permissions; -v: display creation details. Usage example: mkdir new_dir, recursively create a directory: mkdir -p dir1/dir2/dir3, set permissions: mkdir -m 755 private.
The role of the mkdir command in Linux
The mkdir command is used to create directories (folders) in the Linux operating system ). It is one of the basic tools for creating organized files and directories.
Syntax:
mkdir [选项] <目录名称>
Options:
-p
: Recursively create directories and intermediate directories.-m
: Create a directory and set permissions.-v
: Display detailed information about creating the directory.How to use:
The syntax is very simple. To create a directory, enter the following at the command line:
mkdir <目录名称>
For example, to create a directory named "new_dir", use the following command:
mkdir new_dir
Create directories recursively :
Use the-p
option to create directories recursively, including intermediate directories. This means that the parent directories will be created even if they do not exist.
For example, to create the nested directory "dir1/dir2/dir3", you can use the following command:
mkdir -p dir1/dir2/dir3
Set permissions:
Use # The ##-moption sets permissions when creating a directory. Permissions are expressed in octal numbers, for example:
mkdir -m 755 private
The mkdir command does not accept full paths to directories. It can only create directories within the current directory.
Use the
The above is the detailed content of What is the function of mkdir command in linux. For more information, please follow other related articles on the PHP Chinese website!