Skip to content

mkdir command

Create directories.

On this page

Syntax

mkdir [options] directory…

Provided by the coreutils package. Run man mkdir for the full manual.

Common options

OptionWhat it does
-pCreate parent directories as needed; no error if it exists
-m MODESet permissions, e.g. -m 755
-vPrint each directory created

Examples

  1. Create a directory

    mkdir backups
  2. Create nested directories

    mkdir -p /opt/app/logs/2026
  3. Create several at once

    mkdir css js img
  4. Create a tree with brace expansion

    mkdir -p project/{src,tests,docs}
  5. Create with permissions

    mkdir -m 700 ~/.secrets

mkdir guides

← All Linux commands · Suggest a fix

Back to top