How to Create Directories in CentOS?

Publish on July 29, 2020

In this post we will see how to create Directories in CentOS using terminal commands. CentOS is a Community Enterprise operating system which mainly focuses on the server. It is a part of Linux Operating System Distribution, and it is free to use.

Total Time Needed: 30 Minutes

Required Tools:


Steps to create Directories in CentOS

Step 1 : 1. Create Single Directory
To create a single Directory:
The Command used to create a Single Directory is mkdir. Enter the Command mkdir along with Directory name, For example, to create a directory dir4 enter the Command mkdir dir4.

Check if the directory is created - Enter the command ls and press Enter. You can see that dir4 is created.

Step 2: Create Multiple Directories
Use the same command mkdir as above and type all the names of directories to be created. For example, to create directories dir5, dir6, dir7. Type mkdir dir5 dir6 dir7 and press enter

Check if the directories are created: -
Type the command ls and press Enter. You can see that dir5, dir6, dir7 are created

Step 3: Create a Directory at a Particular Location
To create a directory in a different location, type the command mkdir, and the path to the location. For example, to create a directory Dir8 in Desktop, the path to the desktop is /root/Desktop. Type mkdir /root/Desktop/ Dir8.

Step 4: Create Multiple Directories Inside Each Other.
To create a directory inside another directory which is not created yet use the command
mkdir –p . For example, to create a directory dire inside dird which is inside dire.
Type mkdir –p dirc/dird/dire and press enter

Now you can create Directories in CentOS easily following these steps. However, if you have any doubts and need help to manage you Linux infrastructure please reach medha Hosting.
Read Here: How To Install CentOS On Virtual Machine?

Likes this Article
Search for More Help
Want to learn more?
Join our MedhaCloud community of over a million developers for free!
Get help and share knowledge about us.

You must Log in to post a comment or reply

Popular Author