Command referencemkdir
mkdir command (Linux / bash / sh / zsh)
What it does
Create one or more directories. When people search for the mkdir command linux, they usually want mkdir's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.
Create one or more directories.
Syntax
mkdir [OPTION]... DIRECTORY...
Common options
| Flag / option | Meaning |
|---|---|
| -p | Create missing parent directories and ignore existing ones. |
| -m MODE | Set permissions on creation. |
| -v | Report each created directory. |
Practical examples
Create folder
mkdir reports
Creates reports in the current directory.
Create parents
mkdir -p data/2026/september
Builds the full nested path.
Set mode
mkdir -m 750 private
Creates a directory with restricted permissions.
Linux ↔ Windows equivalent
Closest match: mkdir (Windows / CMD). Create a directory and any missing intermediate directories.
Common mistakes
- Omitting `-p` when parent directories do not exist.
- Using Windows backslashes in a Linux path.
Related commands
- cdChange the shell's current working directory.
- chmodChange file permission bits and special modes.
- rmRemove files and directory trees permanently.
- lsList directory entries and inspect file metadata.
- dirList files and subdirectories with names, dates, sizes, and attributes.
- findWalk directory trees and select entries using tests and actions.
- Get-ChildItemEnumerate items and child items in filesystem, registry, and other providers.
- cdDisplay or change the current directory in Command Prompt.
FAQ
What does mkdir do in Linux?
Create one or more directories.
How do I use mkdir from the terminal?
Start with `mkdir [OPTION]... DIRECTORY...`, then choose only the options needed for the task.
What is a practical mkdir example?
Try `mkdir reports` — Creates reports in the current directory.
Can I use mkdir in a shell script?
Yes. mkdir works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.