What is the mkdir Command?
If you need to create a new directory to store files or other directories, you use the mkdir command. It can also create directories inside other directories by using the -p option.
Syntax:
mkdir [options] directory_name
Example 1: Create an empty directory
Command:
$ pwd $ mkdir Ram
Output:
/project
Explanation:
- Use the pwd command to check your current directory location.
- Then, run the mkdir command with the directory name Ram to create a new directory inside the current directory.
Example 2: Create a directory using the recursive path
Command:
$ mkdir -p /home/user/Desktop/Ram
Output:
(No output)
Explanation:
- Use the pwd command to check your current directory location.
- Provide the complete path where you want to create the new directory.
- The -p option creates the parent directories automatically if they do not exist.
- Finally, the mkdir command creates the Ram directory at the specified location.












