Making Directories with mkdir 📂


The mkdir command (short for "make directory") in Bash is for creating new folders or directories on your system. It's essential for keeping your files organized.

To create a new, empty directory, run:

bash
mkdir myfolder

Summary of mkdir Options

  • -p: Create parent directories as needed.
  • -v: Show a message for each directory created.
  • -m: Set file mode (permissions) for the new directory.

Creating Parent Directories with -p

Sometimes you want to create a directory deep within a structure, but the parent directories don't exist yet. The -p (parents) option comes to the rescue! It will create any necessary parent directories along the way.

bash
mkdir -p myfolder/bash/tutorial-1

Learn more