Digital Communication


Digital Communication

Linux mkdir command: create a new directory


The Linux mkdir command is used to create one or more folders in a working directory in use. It also allows you to create complex folder hierarchies.

Linux mkdir command: what is it?

You can use the mkdir command to create a new directory in Linux. While it is also possible to achieve this using a graphical file manager, this command is essential if you want to work directly from the command line. For major Linux distributions, including Ubuntu, the Linux mkdir command is therefore one of the most frequently used commands. “mkdir” is short for “Make Directory”.

How does the mkdir command work?

To create a new directory with the mkdir command, you must imperatively find yourself in the right directory. Indeed, the command creates a new default directory where you are. To insert the directory in question in another location, use the Linux cd command to navigate to the desired location. All you have to do is create the new directory there with the mkdir command. With the Linux mkdir command, you can also create multiple folders, or an entire hierarchy by adding subfolders. We’ll tell you how to do it below.

What does the mkdir command syntax look like?

The mkdir command syntax is always the same. It looks like this:

$ mkdir [Option] NomDuRépertoire


The mkdir command itself can be specified by the options mentioned below. The directory name is the name of the folder you want to create. The spelling must be correct if you want to be able to retrieve the directory later.

What are the mkdir command options?

Three options are provided for the mkdir command. Their respective functions are explained below:

  • -m or –mode: it allows you to assign specific access rights to the new directory. They are indicated after the parameter.
  • -p or –parents: it is used to create the directory(s), if they do not yet exist. Does a directory with the same name already exist in the same location? The system continues without displaying an error message.
  • -v or –verbose: it allows you to display on the command line the elements that the mkdir command is creating. In most cases, this option is combined with the -p option.

mkdir Command: Examples

Finally, to better represent you the use of the Linux mkdir command, let us show you some simple examples related to the command and its functions.

This command creates a new “Contact” folder in the current directory.

$ mkdir Contact Matériel


This command creates two hierarchically equivalent folders, “Contact” and “Material”, in the current working directory.

$ mkdir -p Contact / {Client, Fournisseur} / {Commande, Facture}


This command creates a “Contact” directory in the current folder, based on the following hierarchy:


Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Web Marketing

Overview of the main SEO tools

Andriy OrlovShutterstock Overview of the Best Google SEO Tools If you want to attract as many visitors as possible to your website, you must understand

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact