Linux mkdir Command

Rahul Ahir
2 min readMay 18, 2023

The “mkdir” command in Linux is used to create directories or folders. It allows users to create one or more directories at once, specifying the directory names and their paths.

The basic syntax of the “mkdir” command is as follows:

mkdir [options] directory_name(s)

Here, “options” are optional flags that modify the behavior of the command, and “directory_name(s)” is the name or names of the directories to be created.

Commonly used options with the “mkdir” command:

  • “-p” or “ — parents”: This option enables the creation of parent directories as needed. If a directory in the given path does not exist, the command creates it along with any necessary parent directories. For example:
mkdir -p /path/to/directory

This command will create the “directory” as well as the “to” directory and the “path” directory if they do not already exist.

  • “-m” or “ — mode”: This option allows you to set the permissions or mode of the created directories. You can specify the permissions using numeric notation or symbolic notation. For example:
mkdir -m 755 directory_name

This command will create the “directory_name” with read, write, and execute permissions for the owner (7), read and execute permissions for…

--

--

Rahul Ahir

YouTuber @ahirlog | Software Engineer | Digital Creator