Mkdir


From Linuxconfig.org

Jump to: navigation, search

.. back to the list of Linux Commands

Name

mkdir - make directories

Synopsis - man page

mkdir [OPTION] DIRECTORY...


Frequently used options

-m, --mode=MODE
              set permission mode (as in chmod), not rwxrwxrwx - umask
-p, --parents
              no error if existing, make parent directories as needed

Media

Examples

Creating directory in the Linux environment is very simple task. Let's create directory named "dir1":

mkdir dir1

Image:mkdir1.gif

mkdir command can take more arguments. For example we can take two directories with only one command:

mkdir dir2 dir3

Image:mkdir2.gif

mkdir command can also create entire directory tree. By using -p option mkdir will also create parent directories if required:

mkdir -p dir4/dir4.1

Image:mkdir3.gif

By default mkdir creates directory with permissions set by umask. To force mkdir to create directory with different permissions the -m option can be used. For example to create directory with permissions 744 we can issue following command:

mkdir -m 744 dir5

Image:mkdir4.gif

.. back to the list of Linux Commands

Personal tools
Linux Commands