You are currently viewing Linux Commands – mkdir

Linux Commands – mkdir

Linux Commands – mkdir

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed cd command in Linux which is used to change the current working directory in Linux.

https://cloudaffaire.com/linux-commands-cd/

In this blog post, we will discuss mkdir command in Linux. mkdir stands for make directory and is used to create a new directory. You can create a single, multiple, or multilevel directory using mkdir command.

Linux Commands – mkdir:

You can create a new directory simply using mkdir <directory_name>. Multiple directory can also be created at once using mkdir <mydir1> <mydir2> .. <mydirN> or mkdir mydir{1..N}

You need to have sufficient permission in the parent directory to create a directory.

You can use -v or –verbose option with mkdir command to print a message each time a directory is been created.

You can use mkdir -p or –parents option with mkdir to create a parent directory while creating a child directory. If the parent directory does not exist it will create the parent directory.

You can also create complex directory structure using combination of -p and parameter expansion.

You can use -m or –mode=MODE option with mkdir command to set file mode (as in chmod).

Hope you have enjoyed this article. In the next blog post, we will discuss rm command in Linux.

 

This Post Has One Comment

  1. Avatar
    venkat

    Hi

    Good and very useful information about mkdir command. Every option is explained well and easy to understand.

Leave a Reply