CMD Master
Back to Blog
Arnošt Havelka

Creating Directories with mkdir

Master mkdir to create single and nested directory structures.

Start Interactive Lesson
Creating Directories with mkdir

The mkdir command creates directories (folders). It's the foundation of file organization.

Create a Single Directory

Use mkdir followed by a directory name to create one folder.

Try the command

Create a new directory!

Build the command
mkdirdirname
Choose a command
Terminal
C:\Users\User>mkdir Projects

Create a folder:

Command Prompt
Documents Pictures
C:\Users\User>ls

Create Nested Directories: mkdir -p

The -p flag creates parent directories as needed. Perfect for building entire folder structures at once.

Try the command

Build nested folders!

Build the command
mkdir-pparent/child/grandchild
Choose a command
Terminal
C:\Users\User>mkdir -p src/components/buttons

Build structures instantly:

Command Prompt
existing_folder
C:\Users\User>ls

Create Multiple Directories

Create several folders at the same level with one command.

Try the command

Create multiple folders!

Build the command
mkdirdir1 dir2 dir3
Choose a command
Terminal
C:\Users\User>mkdir src docs tests

Batch directory creation:

Command Prompt
C:\Users\User>ls

Knowledge Check

1 / 3

What does mkdir do?

References

These documentation links provide authoritative details for the commands used in this article.

Up Next

Create empty files with touch

Make a new empty file, or update the timestamp on a file that already exists.