•Arnošt Havelka
Creating Directories with mkdir
Master mkdir to create single and nested directory structures.
Start Interactive LessonThe 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
mkdirMake Directory - creates a new directory with the specified name.
Terminal
C:\Users\User>mkdir dirname
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
-pParents - creates parent directories as needed if they don't exist.
Terminal
C:\Users\User>mkdir -p parent/child/grandchild
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
dir1 dir2 dir3Multiple directories - creates all of them in the current location.
Terminal
C:\Users\User>mkdir dir1 dir2 dir3
Batch directory creation:
Command Prompt
C:\Users\User>ls
Knowledge Check
1 / 3What does mkdir do?
References
These documentation links provide authoritative details for the commands used in this article.