TL;DR
To create new directories using mkdir command, you can try these five methods:
- Easily create a single directory by using the
mkdircommand and specifying the desired name. - Save time by using the
mkdircommand to create multiple directories simultaneously, just separate the names with spaces. - Organize your files in a hierarchical structure by using the
mkdircommand with slashes to create nested directories. - Set specific permissions while creating directories by using the
mkdircommand with the -m option and desired permissions. - Keep track of file changes by incorporating timestamps into directory names using the
mkdircommand.
Common errors when using the mkdir command include “Permission Denied,” “Directory Already Exists,” “Invalid Characters in Directory Name,” and “Insufficient Disk Space.” Resolving these errors involves running the command with administrative privileges, ensuring unique directory names, using valid characters, and freeing up disk space.
Continue reading the guide below to learn to create new directories using mkdir command and the common errors that can occur while using the command.
The mkdir command, short for “make directory,” is a fundamental tool that allows you to create new directories effortlessly. With a few simple commands, you can create single directories, multiple directories, nested directories, and even directories with specific permissions. No more clicking through a graphical interface or typing lengthy commands manually! The mkdir command streamlines the directory creation process, saving you time and effort. In this article, I will explore the five types of directories that can be created using the mkdir command, explore advanced directory creation techniques, and common errors that can occur while using mkdir command.
How to Create New Directories Using mkdir Command
To create new directories using mkdir command in Linux, you have several powerful methods at your disposal. From creating single directories to managing nested directories and setting specific permissions, the mkdir command provides flexible options for organizing your files and folders. Additionally, you can incorporate timestamps into directory names for better version control.
1. Single Directories
Creating a single directory using the mkdir command is a straightforward method that allows you to quickly organize your files and folders with meaningful names, making it easier to locate and manage specific content. To create a single directory, follow these steps:
- Open the Terminal.

- Enter the following command to create a directory named documents:
<strong>mkdir documents</strong> - Press Enter to execute the command.

2. Multiple Directories
The ability to create multiple directories simultaneously with the mkdir command saves time and effort, making it ideal for situations where you need to create several related directories at once, such as setting up project folders or organizing different categories of files.To create multiple directories simultaneously, follow these steps:
- Launch the Terminal window and enter the mkdir command, followed by the names of the directories separated by spaces. For example, to create directories named photos, videos, and documents, use the following command:
<strong>mkdir photos videos documents</strong> - The command will create multiple directories at the same time.

3. Nested Directories
The capability to create nested directories or subdirectories using the mkdir command enables you to establish a hierarchical structure for your files, providing a systematic organization that simplifies navigation and enhances overall file management. Follow these steps to create nested directories:
- Access the command window.
- Specify the parent directories along with the child directory names, separated by slashes (/). For example, to create a directory structure with a parent directory named parent and a child directory named child, use the following command:
<strong>mkdir -p parent/child</strong> - The command will create a hierarchical structure of the directories.

4. Directories with Different Permissions
By utilizing the mkdir command to create directories with specific permissions, you can ensure the security and integrity of your files, granting appropriate access levels to different users or groups, thus maintaining control over your directory structure. To set specific permissions while creating directories, follow these steps:
- Enter your command window.
- Enter the mkdir command, followed by the directory name and the desired permissions. For example, to create a directory named private with read and write permissions, use the following command:
<strong>mkdir -m 600 private</strong> - The output will be:

5. Directories with Timestamps
Incorporating timestamps into directory names using the mkdir command helps you track file changes and assists in version control, providing valuable information about the creation or modification times of files, allowing for better organization and historical references.Follow these steps to create directories with timestamps:
- Luanch the Terminal window and run the mkdir command, followed by the desired directory name, along with the timestamp. For example, to create a directory named backup_20230607, use the following command: