mkdir command in Linux / Unix




Linux mkdir command.

mkdir  Creates directories with the given names. mkdir creates the DIRECTORY(ies), if they do not already exist.

mkdir command syntax

mkdir [OPTION]… DIRECTORY…

mkdir mkdir dir1 dir2 dir3 create directories dir1, dir2, dir3

mkdir command options

mkdir command main options:

option description
-m, –mode=MODE set file mode (as in chmod), not a=rwx – umask
-p, –parents no error if existing, make parent directories as needed
-v, –verbose print a message for each created directory
-Z, –context=CTX set the SELinux security context of each created directory to CTX
–help display this help and exit
–version output version information and exit

mkdir command examples

Now let us practice some mkdir commands.

 

mkdir – create directory:

$ mkdir dir
$ ls
dir
$

 


mkdir -p parent/child – To create directory paths with parent directories that do not exist:

$ mkdir -p parent/child 
$ ls parent
child
$

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*