Home » Linux » Basic Linux Commands » mkdir Linux Command

mkdir Linux Command

The mkdir command in Linux is used to create a new directory.

The Syntax of mkdir command is as below,

$ mkdir [OPTION]… DIRECTORY

We can see some of the examples of using mkdir as,

$ mkdir my_new_directory

Options can be added to customize the creation of the directory, such as

  • -p to create parent directories if they don’t exist
  • -m to specify permissions for the new directory.

The example of using “-p” option can be sometime like below,

$ mkdir -p my_new_directory/directory1/directory2/directory3

With about command, all the directory will get created if those are not existed, so the output of tree command can look as,

$ tree my_new_directory/
my_new_directory/
└── directory1
    └── directory2
        └── directory3

3 directories, 0 files

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment