Site icon LinuxCommands.site

mkdir command tutorial in linux/unix with examples and use cases

linux mkdir command – make directories

Linux mkdir command is used to create directories. If the directory does not exist, it is created.

Syntax

 mkdir [OPTION]... DIRECTORY...

Options

Examples & Use Cases

Create multiple directories

In the following example we will create multiple directories under the current directory at the same time.

 ➜  mkdir dir-1 dir-2 dir-3

Create parent and child directory

In the following example, we are creating a multi-level directory, with both parent and child directories.

 ➜  mkdir -p parent/child

Create directory and set permissions

In the following example, directory permissions are set when the directory is created.

 ➜  mkdir -m 777 directory

Exit mobile version