Create Directory In Linux Mkdir Tutorial

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/create-directory-linux-mkdir-tutorial/
PINTEREST
PINTEREST
INSTAGRAM

Linux is all about directories. But how can we create directories in simple or complex way? How can we create directories in multi level at a single shot command? We will look examples of  mkdir command in this post.

Syntax

Create Directory

We create a directory simple using mkdir and directory name. In this example we will create a directory named test1

Create Directory

Create Directory

Set Mode

While creating a directory it can be set directory permission or mode with -m parameter.

Set Mode

Set Mode

Here we set user, group and others permissions and make this all can make read, write, execute which is secure this directory 😉

Make Parents

We may create multilevel directories where intermediate directories do not exists currently. This operation will also create intermediate directories. In this example we will create a directory hierarchy like test3/test4/test5 where they will be created in a row.

Make Parents

Make Parents

Print Verbose

While creating directories there will be no output about the operations. If we need to get more information or verbose output we can use -v option. This will provide log for each operation for each directory creation.

Print Verbose

Print Verbose

Set Selinux Context

Selinux provides extra layer for security. Directory related default context can be set by using -Z .

Set Selinux Context

Set Selinux Context

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/create-directory-linux-mkdir-tutorial/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)