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?✗ Incorrect
The correct command to create a directory is
mkdir followed by the directory name.What does the
-p option do in mkdir -p projects/code?✗ Incorrect
The
-p option creates parent directories if they do not exist.What happens if you run
mkdir photos twice without -p?✗ Incorrect
Trying to create an existing directory without
-p causes an error.How do you create three directories named
one, two, and three at once?✗ Incorrect
Listing directory names separated by spaces creates them all at once.
Which command creates nested directories
parent/child/grandchild in one step?✗ Incorrect
The
-p option allows creating nested directories in one command.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.