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]...

Options:
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.

Examples

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
/home/rubelix/public_html/test/testdir/level1/level2
    

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

   
Social Login Joomla

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

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

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?

Search

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: support@InMotionHosting.com
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!