The mkdir command in Linux is used to create directories. The syntax is: mkdir [options] [directory name]. Options include: -p (create non-existent parent directory), -m (set directory permission mode), -v (display details). Usage examples: mkdir Documents can create a directory named "Documents"; mkdir -p Documents/Work can create a "Documents/Work" subdirectory; mkdir -m 755 Documents can set the permission mode of the "Documents" directory to 755.
The mkdir command in Linux
The mkdir command is used to create a new directory (file folder). It is a powerful tool that allows you to organize and manage files easily.
Syntax:
mkdir [选项] [目录名称]
Options:
How to use the mkdir command:
To create a new directory, use the following syntax:
mkdir [选项] 目录名称
For example, to create a To create a new directory named "Documents", use the following command:
mkdir Documents
To create a multi-level directory using the mkdir command, use the-p
option. For example, to create a subdirectory named "Documents/Work", you would use the following command:
mkdir -p Documents/Work
To set the permission mode of the new directory, use the-m
option. For example, to set the permission mode of the "Documents" directory to 755, you would use the following command:
mkdir -m 755 Documents
Other useful examples:
mkdir /tmp/tmp-dir
mkdir -p /path/to/new-dir
mkdir -m 775 /path/to/secure-dir
The above is the detailed content of What is the command mkdir in linux?. For more information, please follow other related articles on the PHP Chinese website!