mkdir command Updated on June 23, 2014 by Scott Mitchell 1 Minutes, 8 Seconds to Read 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 Share this Article Related Articles Understanding Linux Operating Systems How to Install Python 3.9 on CentOS 7 Speed Up grep Searches with LC_ALL=C How To Install RubyGems On Linux unrar and rar Commands 5 Ways to Find a File in Linux Setting Your PHP Settings in Command Line How to Check the Memory Usage on Linux How to Send Files to the Trash Can in Linux with Gio Trash How to Merge PDF Files in the Linux Terminal