Linux for Developers Course
Linux for Developers
/
Beginner

mkdir

Definition

Make Directory. The command used to create new directories (folders) in the file system.

Explain Like I'm New

The 'Create New Folder' button in the terminal.

Real World Example

You start a new project. You type `mkdir src` and it creates a folder named 'src'.

Common Use Cases

  • •Organizing files
  • •Scripting project setups

Crucial Command Flags

Flag / OptionDescription
-pParents. Create parent directories as needed, no error if existing.
-vVerbose. Print a message for each created directory.

Interview Questions

basic

  • What does `mkdir` stand for?

intermediate

  • How do you create a folder AND a subfolder inside it at the exact same time (e.g., `mkdir parent/child`) without getting an error?

Flash Cards

Question

What does it stand for?

Click to reveal answer
Answer

Make Directory.

Question

Create parent and child?

Click to reveal answer
Answer

Use the `-p` (parents) flag: `mkdir -p parent/child`. It automatically creates any missing parent directories required.