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

  1. Notes
    mkdir directory_name ...

    The user must have write permission in the parent directory.
  2. Examples
    • Create a directory:
      $ mkdir folder

    • Create multiple directories and optionally their sub-directories:
      $ mkdir folder folder/folder1 folder/folder2

    • You can use the option -p to create a sub-directory and its parents if they don't exist:
      $ mkdir -p folder/folder2

    • Create a directory with a specific permission:
      $ mkdir -m 777 folder
  3. Command Help (man mkdir)
    The following options can be used:
    -m <mode>
    |Set the file permission mode of the created directory.
    |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
    |Create intermediate directories as required.
    |If this option is not specified, the full path prefix of each operand must already exist.
    |On the other hand, 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
    |Cause mkdir to be verbose, showing files as they are created.
© 2025  mtitek