used to create directories
mkdir command is used to create directories. 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 efficiently. It's best to use consistent naming to distinguish files and directories. For example, a directory name can begin 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.
mkdir (options) (parameters)
-Z: Set the security context, effective when using SELinux;
-m<target attribute> or --mode <target attribute> sets the directory permissions while creating the directory;
-p or --parents If the upper-level directory of the directory to be created has not been created yet, the upper-level directory will be created together;
--version Display version information.
Directory: Specify a list of directories to be created. Multiple directories are separated by spaces.
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