Account
Categories

mkdir command


Definition:

When you need to make a directory to store a file or directory, you use this command. It also makes the directory in the recursive path for other directories.


Syntax:

$ mkdir [directory_name]
    

Example 1: Create a directory in the current folder

Command:

$ pwd
$ mkdir Ram
    

Output:

/project
Ram
    

Explanation:

  • Use pwd to check your current directory location.
  • Then, run the mkdir command with the folder name Ram to create a new directory inside the Project folder.

Example 2: Create a directory using full path (recursive)

Command:

$ pwd
$ mkdir /home/user/Desktop/Ram
    

Output:

/home/user/project
Ram
    

Explanation:

  • Use the pwd command to check your current directory location.
  • Once you know the path, you provide the full location where you want to create the new directory.
  • Finally, run the mkdir command to create the Ram directory inside the Desktop folder.