Chapter 2. Linux Key Commands

Mkdir (Make Directory)

Mkdir (Make Directory)
Tag:

To create a new directory, you can use the mkdir (MaKe DIRectory) command while specifying the directory path and including the new directory name at the end of the path.

Create a new directory with the relative path

To create a new directory named dir_a under your working directory, run the command below.

Command Line - INPUT
mkdir dir_a

If you want to create a new directory named dir_b under the parent directory, run the command below.

Command Line - INPUT
mkdir dir_b

Create a new directory with the absolute path

You can use the absolute path to create a new directory. To create dir_c under the ubuntu directory, you can run the command below.

Command Line - INPUT
mkdir /home/ubuntu/dir_c

-p option

If you want to create multiple directories with a tree structure, you can use the -p option. To create three directories like dir_3 under dir_2 under dir_1 under your home directory, you can run the command below.

Command Line - INPUT
mkdir -p ~/dir_1/dir_2/dir_3

To create a new directory, you can use the mkdir (MaKe DIRectory) command while specifying the directory path and including the new directory name at the end of the path.

Create a new directory with the relative path

To create a new directory named dir_a under your working directory, run the command below.

Command Line - INPUT
mkdir dir_a

If you want to create a new directory named dir_b under the parent directory, run the command below.

Command Line - INPUT
mkdir dir_b

Create a new directory with the absolute path

You can use the absolute path to create a new directory. To create dir_c under the ubuntu directory, you can run the command below.

Command Line - INPUT
mkdir /home/ubuntu/dir_c

-p option

If you want to create multiple directories with a tree structure, you can use the -p option. To create three directories like dir_3 under dir_2 under dir_1 under your home directory, you can run the command below.

Command Line - INPUT
mkdir -p ~/dir_1/dir_2/dir_3
Tag: