{
    "mode": "man",
    "parameter": "MKDIR",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/MKDIR/1/json",
    "generated": "2026-06-05T21:15:48Z",
    "synopsis": "mkdir [OPTION]... DIRECTORY...",
    "sections": {
        "NAME": {
            "content": "mkdir - make directories\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "mkdir [OPTION]... DIRECTORY...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Create the DIRECTORY(ies), if they do not already exist.\n\nMandatory arguments to long options are mandatory for short options too.\n",
            "subsections": [
                {
                    "name": "-m --mode",
                    "content": "set file mode (as in chmod), not a=rwx - umask\n",
                    "flag": "-m",
                    "long": "--mode"
                },
                {
                    "name": "-p --parents",
                    "content": "no error if existing, make parent directories as needed\n",
                    "flag": "-p",
                    "long": "--parents"
                },
                {
                    "name": "-v --verbose",
                    "content": "print a message for each created directory\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-Z",
                    "content": "--context[=CTX]\nlike -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX\n\n--help display this help and exit\n",
                    "flag": "-Z"
                },
                {
                    "name": "--version",
                    "content": "output version information and exit\n",
                    "long": "--version"
                }
            ]
        },
        "AUTHOR": {
            "content": "Written by David MacKenzie.\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright  ©  2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later\n<https://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.  There is NO WARRANTY,  to\nthe extent permitted by law.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "mkdir(2)\n\nFull documentation <https://www.gnu.org/software/coreutils/mkdir>\nor available locally via: info '(coreutils) mkdir invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                    MKDIR(1)",
            "subsections": []
        }
    },
    "summary": "mkdir - make directories",
    "flags": [
        {
            "flag": "-m",
            "long": "--mode",
            "arg": null,
            "description": "set file mode (as in chmod), not a=rwx - umask"
        },
        {
            "flag": "-p",
            "long": "--parents",
            "arg": null,
            "description": "no error if existing, make parent directories as needed"
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "print a message for each created directory"
        },
        {
            "flag": "-Z",
            "long": null,
            "arg": null,
            "description": "--context[=CTX] like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX --help display this help and exit"
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "output version information and exit"
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "mkdir",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/mkdir/2/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Create directories and set their permissions.",
        "examples": [
            {
                "description": "Create specific directories",
                "command": "mkdir {{path/to/directory1 path/to/directory2 ...}}"
            },
            {
                "description": "Create specific directories and their parents if needed",
                "command": "mkdir {{-p|--parents}} {{path/to/directory1 path/to/directory2 ...}}"
            },
            {
                "description": "Create directories with specific permissions",
                "command": "mkdir {{-m|--mode}} {{rwxrw-r-}} {{path/to/directory1 path/to/directory2 ...}}"
            },
            {
                "description": "Create multiple nested directories recursively",
                "command": "mkdir {{-p|--parents}} {{path/to/{a,b}/{x,y,z}/{h,i,j}}}"
            }
        ]
    }
}