In Linux, the command to create a directory is mkdir. It supports the creation of nested directories, the creation of multiple directories simultaneously, and provides options to control creation behavior, such as setting permissions and automatically creating parent directories.
Commands used to create directories in Linux
Creating directories is a common operation in Linux systems. It allows users to organize and manage files. In Linux, the command to create a directory is mkdir
.
Use mkdir to create a directory
mkdir
The basic syntax of the command is as follows:
mkdir <目录名称>
For example, to create a directory named "Documents " directory, you can use the following command:
mkdir Documents
Create a nested directory
mkdir
The command also allows the creation of nested directories, that is, in the current Create subdirectories within a directory. To create nested directories, use absolute or relative paths in the command.
For example, to create a nested directory "Documents/Projects", you can use the following command:
mkdir Documents/Projects
Create multiple directories
The mkdir
command can create multiple directories at the same time by specifying multiple directory names in the command. Each directory name should be separated by spaces.
For example, to create the "Documents", "Projects" and "Personal" directories, you can use the following command:
mkdir Documents Projects Personal
Options
## The #mkdir command provides several options to control the directory creation behavior:
: Set the mode (permissions) of the directory.
: If it does not exist, the parent directory will be automatically created.
: Displays details for each directory being created.
: Display the help information of the command.
mkdir -m 755 Documents
The above is the detailed content of Which command to use to create a directory in linux. For more information, please follow other related articles on the PHP Chinese website!