0
0
Linux CLIscripting~5 mins

mkdir (create directories) in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the mkdir command do in Linux?
The mkdir command creates a new directory (folder) in the file system.
Click to reveal answer
beginner
How do you create a directory named photos using mkdir?
Use the command: mkdir photos to create a directory called photos in the current location.
Click to reveal answer
intermediate
What option do you use with mkdir to create parent directories if they do not exist?
Use the -p option. For example, mkdir -p parent/child creates both parent and child directories if they don't exist.
Click to reveal answer
beginner
What happens if you try to create a directory that already exists without using -p?
The mkdir command will show an error saying the directory already exists and will not create it.
Click to reveal answer
intermediate
How can you create multiple directories at once with mkdir?
You can list multiple directory names separated by spaces. For example, mkdir dir1 dir2 dir3 creates three directories at once.
Click to reveal answer
Which command creates a directory named work?
Afolder make work
Bcreate work
Cnewdir work
Dmkdir work
What does the -p option do in mkdir -p projects/code?
ACreates parent directories if missing
BPrompts before creating directories
CPrints the directory path
DDeletes the projects directory
What happens if you run mkdir photos twice without -p?
AIt overwrites the directory
BIt shows an error that directory exists
CIt creates a new directory inside photos
DIt deletes the existing directory
How do you create three directories named one, two, and three at once?
Amkdir -p one two three
Bmkdir one; mkdir two; mkdir three
Cmkdir one two three
Dmkdir all one two three
Which command creates nested directories parent/child/grandchild in one step?
Amkdir -p parent/child/grandchild
Bmkdir parent child grandchild
Cmkdir parent/child/grandchild
Dmkdir -n parent/child/grandchild
Explain how to create a directory and nested directories using mkdir. Include what happens if the directory already exists.
Think about creating one folder vs many folders inside each other.
You got /3 concepts.
    Describe how to create multiple directories at once with mkdir and why this might be useful.
    Imagine you need several folders for a project.
    You got /2 concepts.