Challenge - 5 Problems
mkdir Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
π» Command Output
intermediate1:30remaining
What is the output of this mkdir command?
You run the command
mkdir -p /tmp/testdir/subdir on a Linux system. What happens if /tmp/testdir does not exist?Linux CLI
mkdir -p /tmp/testdir/subdir
Attempts:
2 left
π‘ Hint
The -p option helps create parent directories if missing.
β Incorrect
The -p flag tells mkdir to create parent directories as needed. So if /tmp/testdir doesn't exist, it will be created first, then subdir inside it.
π» Command Output
intermediate1:30remaining
What error does this mkdir command produce?
You run
mkdir /root/newdir as a normal user (not root). What is the expected output?Linux CLI
mkdir /root/newdir
Attempts:
2 left
π‘ Hint
Normal users usually cannot write inside /root directory.
β Incorrect
The /root directory is owned by root user only. Normal users lack permission to create directories there, so mkdir fails with a permission denied error.
π Syntax
advanced1:30remaining
Which mkdir command creates multiple directories at once?
You want to create three directories named dir1, dir2, and dir3 in your current folder with one command. Which option is correct?
Attempts:
2 left
π‘ Hint
mkdir can take multiple directory names separated by spaces.
β Incorrect
The mkdir command accepts multiple directory names separated by spaces to create them all at once. Option A does this correctly.
π» Command Output
advanced1:30remaining
What is the effect of this mkdir command with -m option?
You run
mkdir -m 700 secret. What are the permissions of the created directory?Linux CLI
mkdir -m 700 secretAttempts:
2 left
π‘ Hint
The -m option sets the permission mode of the new directory.
β Incorrect
The -m 700 option sets permissions so only the owner has read, write, and execute rights. Others have no permissions.
π Application
expert2:00remaining
How many directories are created by this command?
You run
mkdir -p /tmp/a/b/c /tmp/a/d/e. How many new directories are created if none of these exist?Linux CLI
mkdir -p /tmp/a/b/c /tmp/a/d/e
Attempts:
2 left
π‘ Hint
The -p option creates all missing parent directories for each path.
β Incorrect
The command creates /tmp/a first, then /tmp/a/b, then /tmp/a/b/c for the first path. For the second path, /tmp/a/d and /tmp/a/d/e are created. /tmp exists already, so not counted.