1. Command Introduction
The Linux mkdir command is used to create a directory of the specified name, requiring the user who created the directory to have write permissions in the current directory, and the specified directory name cannot be a directory that is already in the current directory.
2. Command use
Create a folder
3. Instructions for using the command
[Email protected] ~]# mkdir--help Usage:mkdir [OPTION] ... DIRECTORY ... Create the DIRECTORY (ies), if they does not already exist. Mandatory arguments to long options is Mandatory for short options too. -M,--mode=mode set file mode (as in chmod), not A=rwx-umask -P,--parents no error if existing, make parent directories as needed -V,--verbose print a message for each created directory -Z,--context=ctx set the SELinux security context of each created Directory to CTX --help Display this Help and exit --version output version information and exit |
4. Command Common parameter description
Parameter options |
Parameter description |
-M |
Set folder permissions yourself when creating a folder |
-P |
If you create a subdirectory that does not exist, you can create it recursively |
-V |
Display information for creating a directory |
5. Command examples
5.1 With no parameters
[Email protected] ~]# Mkdir/test1
[Email protected] ~]# Ls-ld/test1
Drwxr-xr-x 2 root root 4096 Sep 10:50/test1
5.2-p parameters
[Email protected] ~]# MKDIR/TEST2/ABC
Mkdir:cannot Create directory '/TEST2/ABC ': No such file or directory
[Email protected] ~]# mkdir-p/TEST2/ABC
[Email protected] ~]# LL-LD/TEST2/ABC
Drwxr-xr-x 2 root root 4096 Sep 10:51/TEST2/ABC
5.3-m parameters
[Email protected] ~]# MKDIR/AAA
[Email protected] ~]# LS-LD/AAA
Drwxr-xr-x 2 root root 4096 Sep 10:52/aaa
[Email protected] ~]# mkdir-m 777 BBB
[Email protected] ~]# ls-ld BBB
DRWXRWXRWX 2 root root 4096 Sep 10:53 BBB
5.4-v parameters
[Email protected] ~]# mkdir-v CCC
mkdir:created directory ' CCC '
Linux command--mkdir