Linux command--mkdir

Source: Internet
Author: User
Tags create directory

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.