MTI TEK
  • Home
  • About
  • LLMs
  • Docker
  • Kubernetes
  • Java
  • All Resources
Linux-Ubuntu | mkdir -- make directories
  1. Notes
  2. Examples
  3. Command Help (man mkdir)

  1. Notes
    mkdir [OPTION]... DIRECTORY...
    
    The mkdir command creates directories. The user must have write permission in the parent directory.
  2. Examples
    • Create a directory:
      $ mkdir folder
      
    • Create multiple directories:
      $ mkdir folder1 folder2 folder3
      
    • Create nested directories with the -p option (creates parent directories as needed):
      $ mkdir -p folder/folder1/folder11
      
    • Create a directory with specific permissions using -m:
      $ mkdir -m 755 folder
      
    • Create directories with verbose output using -v:
      $ mkdir -v folder1 folder2
      
    • Combine options to create nested directories with specific permissions and verbose output:
      $ mkdir -pv -m 750 folder/folder1
      
  3. Command Help (man mkdir)
    The following options can be used:
    -m, --mode=MODE
        Set file mode (permissions) for the created directories.
        The MODE argument can be in any of the formats specified by the chmod command.
        If a symbolic mode is specified, the operation characters "+" and "-" are
        interpreted relative to an initial mode of "a=rwx".
    
    -p, --parents
        Create intermediate directories as required.
        If this option is not specified, the full path prefix of each operand must
        already exist. With this option specified, no error will be reported if a
        directory given as an operand already exists.
        Intermediate directories are created with permission bits of rwxrwxrwx (0777)
        as modified by the current umask, plus write and search permission for the owner.
    
    -v, --verbose
        Print a message for each created directory.
    
    -Z
        Set SELinux security context of each created directory to the default type.
    
    --context[=CTX]
        Like -Z, or if CTX is specified then set the SELinux or SMACK security context
        to CTX.
    
    --help
        Display help information and exit.
    
    --version
        Output version information and exit.
    
© 2025 mtitek