How to create new directories?

QuestionsQuestions8 SkillsProDec, 25 2025
091

To create new directories in Linux, you use the mkdir command, which stands for "make directory."

Here are the most common ways to use it:

1. Create a single directory

To create a folder named "notes" in your current location, type:

mkdir notes

2. Create multiple directories at once

You can create several folders with one command by separating the names with spaces:

mkdir docs images backups

3. Create nested directories (Parent-Child)

If you want to create a folder inside another folder that doesn't exist yet (like photos/vacation), use the -p (parents) flag:

mkdir -p photos/vacation

This tells Linux: "Make the photos folder first, then make the vacation folder inside it."

4. Verify your new directory

After creating a directory, you can use the ls command to see it:

ls

You will see your new folder listed in the output.

Try it now!

  1. Make sure you are in your project folder: cd /home/labex/project
  2. Create a folder: mkdir my_new_folder
  3. Check if it's there: ls

0 Comments

no data
Be the first to share your comment!