mkdir
What is mkdir?
mkdir: Make Directory — Create a new directory. mkdir creates a new directory. mkdir uploads creates one folder, and mkdir -p storage/app/exports/2026 creates the whole path, including any missing parent folders. The -p option also makes the command safe to run when the folder already exists, which matters in scripts and Dockerfiles that may run more than once.
Frequently asked questions about mkdir
What should you keep in mind with mkdir?
New folders get permissions from your current settings, so check who needs to write to them. A folder created by root during a deploy may not be writable by the web server user, which leads to confusing "permission denied" errors later. Setting the owner right after creating it, or creating it as the correct user, avoids that. mkdir -m 755 sets permissions directly at creation.
At a glance
| Category | CLI commands |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |