Home>Article>Operation and Maintenance> What does the linux command mkdir execute?
The linux command mkdir is executed to create a directory. This command is to create a directory named by dirname. If no path name is added in front of the directory name, the directory specified by dirname will be created in the current directory; if given If you specify an existing path, a specified directory will be created under that directory.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
What does the linux command mkdir execute?
mkdir
Used to create directories
Supplementary instructions
The mkdir command is used Create a directory. This command creates a directory named by dirname. If no pathname is added in front of the directory name, the directory specified by dirname will be created in the current directory; if an existing path is given, a specified directory will be created in that directory. When creating a directory, make sure that the newly created directory does not have the same name as the file in the directory where it is located.
Note:
When creating files, do not store all files in the main directory. You can create subdirectories to organize files more effectively. . It's best to use consistent naming to distinguish files and directories. For example, a directory name can start with an uppercase letter so that it appears first in directory listings.
A subdirectory should contain files of similar type or purpose. For example, you might create a subdirectory that contains all your database files, another subdirectory that contains your spreadsheet files, another subdirectory that contains your word processing documents, and so on. Directories are also files. They follow the same naming rules as ordinary files, and a directory can be uniquely specified using the full path.
Syntax
mkdir (选项)(参数)
Options
-Z: Set the security context, valid when using SELinux;
-me2159669cdc5b0bb5cce1fd0370cb87f or --modee2159669cdc5b0bb5cce1fd0370cb87f Set the permissions of the directory while creating the directory;
-p or --parents If the upper-level directory of the directory to be created has not yet been created, The upper-level directory will be created together;
--version displays version information.
Parameters
Directory: Specify the directory list to be created. Multiple directories are separated by spaces.
Example
Create a subdirectory test under the directory /usr/meng, and only the file owner has read, write and execution permissions, and others do not have access rights
mkdir -m 700 /usr/meng/test
Create bin and the os_1 directory under bin in the current directory. The permissions are set to read, write, and execute for the file owner. Users in the same group can read and execute. Other users have no access rights.
mkdir -p-m 750 bin/os_1
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What does the linux command mkdir execute?. For more information, please follow other related articles on the PHP Chinese website!