"Linux learning is not difficult" file/directory management (6): mkdir command to create a directory

7.6 "Linux learning is not difficult" file/directory management (6): mkdir command to create a directory

Use the mkdir command to create directories in a Linux system.
Command syntax:

mkdir [options] [directory]

The meaning of each option in the command is shown in the table.

Options

Meaning of options

-m < permission mode >

Set permissions on the newly created directory. When there is no -m option, the default permission is 755

-p

Can be a pathname. At this time, if some directories in the path do not exist yet, after adding this option, the system will automatically create those directories that do not exist, that is, multiple directories can be created at one time


Example: Create a directory newdir1 with default permissions of 755.

[root@rhel ~]# mkdir newdir1

Example: Create a directory newdir2 with permissions 777.

[root@rhel ~]# mkdir -m 777 newdir2


This article is excerpted from the textbook " Linux Learning Is Not Difficult" , which is the most practical and practical Linux introductory textbook. To read the entire book, please visit the Linux operator ( www.linuxywz.com ) website .



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325289756&siteId=291194637