Get the App
SLTechnology News&Howtos  ›  Servers  › 

The usage of the Linux basic command mkdir

Shulou Source: shulou.com Published: 2022-06-01 12:38:41 10月09日 Update

This article mainly explains "the usage of the Linux basic command mkdir". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of the basic Linux command mkdir.

Mkdir

If the directory does not exist, then create the directory.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Mkdir [options] dir

2. List of options

Option

Description

-- version

Display command version information

-- help

Show help documentation

-m |-- mode=MODE

Set the permissions of the directory

-p |-- parents

When creating a multi-tier directory, if the parent directory does not exist, create the parent directory first

-v |-- vervose

Show execution process

3. Examples

1) create a directory with maximum permissions

[root@localhost weijie] # mkdir-m 777 test

[root@localhost weijie] # ls-l

Total consumption 360

-rw-r--r-- 1 root root 0 September 7 09:11 1.c

-rw-r--r-- 1 root root 358400 September 7 15:46 my.iso

Drwxrwxrwx 2 root root 4096 September 10 11:33 test

2) create a directory and its parent directory

[root@localhost weijie] # mkdir-v test01/test / / directory test01 does not exist and cannot create a test directory under it

Mkdir: unable to create directory "test01/test": there is no such file or directory

[root@localhost weijie] # mkdir-p-v test01/test / / use the option-p. When directory test01 does not exist, create test01 first.

Mkdir: directory "test01" has been created

Mkdir: directory "test01/test" has been created

You have new mail in / var/spool/mail/root

At this point, I believe you have a deeper understanding of "the use of the Linux basic command mkdir". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Directory command foundation content time permission learning practical deeper maximum information interest multi-layer instance practical practical simple operation file document method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information vpn OPPO Reno Shulou Tech Info