mkdir — Create a new directory across all 5 shells
Equivalents in every shell
Worked examples
Create nested directories
Bash
mkdir -p a/b/cPowerShell
New-Item -ItemType Directory -Path a/b/c -Forcecmd.exe
mkdir a\b\cCreate multiple sibling directories
Bash
mkdir foo bar bazPowerShell
foo, bar, baz | ForEach-Object { New-Item -ItemType Directory -Path $_ }cmd.exe
mkdir foo bar bazCreate with specific permissions
Bash
mkdir -m 755 dirGotchas
- cmd `mkdir` natively creates intermediate directories; Unix `mkdir` needs `-p` for the same behavior.
- PowerShell `mkdir` is a wrapper function around `New-Item -ItemType Directory`; behavior matches cmd, not Unix.
- Permission/mode flags are Unix-only — Windows ACLs are set via `icacls` or `Set-Acl`.
WSL & PowerShell Core notes
pwsh`mkdir` works on every pwsh platform but maps to different things: on pwsh 7+ Linux/macOS hosts it invokes the system `mkdir`, on Windows it is a wrapper function around `New-Item -ItemType Directory`. The portable cmdlet form is `New-Item -ItemType Directory -Path a/b/c -Force` — the `-Force` flag is the cross-platform equivalent of Unix `mkdir -p` (create missing parents, succeed if directory already exists). POSIX mode flags like `-m 755` are silently no-ops on Windows because NTFS uses ACLs, not POSIX permission bits.
WSLCreating a directory from inside WSL on a `/mnt/c/...` path works but the resulting NTFS directory inherits default Windows ACLs — a subsequent `chmod 700` from WSL will not actually restrict access. Conversely, directories created from Windows-side Explorer show up as mode `0777` from WSL because DrvFs synthesises permissive POSIX bits. For build artifacts or anything that needs strict Unix permissions, create them inside `~/` (the real ext4 WSL filesystem), not under `/mnt/c/`.