Overview of mkdir
`mkdir` command creates a new directory at the specified path. It is used to create space for storing files, to structure project directories, or to organize specific paths for system administration purposes. When used without any options, it creates a new directory under the current directory.
Main Functions of mkdir
`mkdir` command is mainly used for the following purposes:
Main Use Cases
- File Organization: Creates folders to categorize and store files by type.
- Project Structuring: Creates directories to separate source code, documentation, build results, etc., for software development projects.
- Backup Space Provisioning: Creates dedicated directories to store backup files.
- System Administration: Organizes specific directories for log files, configuration files, etc.
Key Options for mkdir Command
`mkdir` command provides useful options such as creating parent directories along with the target directory and displaying detailed messages during the creation process.
1. Basic Creation Options
2. Permission and Output Options
Generated command:
Try combining the commands.
Description:
`mkdir` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Learn how to effectively create and manage new directories through various examples of using the `mkdir` command.
Create New Folder in Current Directory
mkdir my_documents
Creates a new folder named `my_documents` inside the current working directory.
Create Multiple Empty Directories at Once
mkdir folder1 folder2 folder3
Simultaneously creates three empty directories named `folder1`, `folder2`, and `folder3` in the current directory.
Create Nested Directories at Once
mkdir -p projects/my_app/src/components
Creates a nested directory structure named `my_app/src/components` under the `projects` directory. If the parent directories `projects`, `my_app`, and `src` do not exist, they will be created automatically.
Create New Directory While Setting Permissions
mkdir -m 755 public_html
Creates the `public_html` directory and sets the owner to have all permissions (7), while the group and others have read and execute permissions (5).
Check Detailed Directory Creation Process
mkdir -pv backup/daily/logs
Creates the `backup/daily/logs` directory while outputting detailed messages about which directories are being created.