mkdir
Create one folder, several at once, or a whole path in one go with mkdir -p.
>_ Try it: a simulated Linux, right herenothing runs on your computer
Loading the terminal…
Examples
-
mkdir projects -
mkdir docs notes -
mkdir -p site/css/fonts -
ls site/css -
ls -l
How it works
mkdir NAME makes a new folder inside the one you are in (pwd tells you which). It prints nothing when it works.
To create a folder inside folders that don't exist yet, add -p: mkdir -p site/css/fonts creates all three. Without it, mkdir says "No such file or directory".
Syntax
mkdir [-p] FOLDER...
Options
| Option | What it does |
|---|---|
-p | make the parent folders too, and don't complain if it already exists |
A B C | several folders in one command |
Good to know
mkdir -pis safe to run twice: plainmkdiron an existing folder says "File exists".- Names with spaces need quotes:
mkdir "My Project". Most people avoid spaces in folder names on Linux.