Create one or more new directories.
low risk
mkdir creates directories. The -p flag creates all parent directories as needed and suppresses errors if already existing — ideal for idempotent scripts and CI pipelines.
| Flag | Meaning |
|---|---|
-p --parents | Create parent dirs as needed, no error if existing |
-m --mode | Set permissions for the new directory (like chmod) |
-v --verbose | Print a message for each created directory |
mkdir -p /opt/app/{logs,config,data}Create app directory with three subdirectories via brace expansion · explain & risk-check →mkdir -m 700 /home/user/.sshCreate .ssh directory with strict owner-only permissions · explain & risk-check →mkdir -pv /var/www/html/static/cssCreate full nested path verbosely · explain & risk-check →Use brace expansion `mkdir -p project/{src,tests,docs,bin}` to scaffold entire project structures in one command.
Reference text is hand-written and may be incomplete — check man mkdir for your version. Test destructive commands on a non-production system first.