InMotion Hosting Support Center

The mkdir command allows you to create directories that you name. This command can create multiple directories at once or even multiple levels creating the parent directories along the way.

Command: mkdir
Synopsis: mkdir [OPTION]... [DIR]...

Option Long option name Description
-m --mode=MODE Set permission mode (as in chmod), not rwxrwxrwx - umask.
-p --parents No error if existing, make parent directories as needed.
-v --verbose Print a message for each created directory.
-Z --context=CONTEXT (SELinux) set security context to CONTEXT.


The Base Command

mkidr [DIR] - Using the base command, the mkdir will create a new directory in the current location. Below we create a new folder named testdir.

# mkdir testdir
# ls
./  ../  error_log  index.php  testdir/  test.txt

Create multiple directories in same folder

mkidr [DIR] - Using the same base command, you can create more than one directory at the same time by separating them with a space. Below we create a new folder named testdir and test2.

# mkdir testdir test2
# ls
./  ../  error_log  index.php  testdir/  test.txt  test2

Create multiple levels at once

mkidr [DIR] - If you are wanting to create a subdirectory tree that goes down more than one level, use the -p option. Here we create a subdirectory tree under testdir/level1/level2.

# mkdir -p testdir/level1/level2
# pwd

Was this article helpful?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved. Please click the button below to be redirected to the login page.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!