>mkdir_
The
The name stands for MaKe DIRectory.
The default ls command syntax is:
The -p flag is necessary to allow the shell to create intermediate directories as required.
mkdir
command is used to create new directoriesThe name stands for MaKe DIRectory.
The default ls command syntax is:
mkdir [flags] [-m mode] directory_name ...Where [flags] are the mkdir
-p
and -v
- flags,
read below for more info, and directory_name is the
name of the new directory we are going to create.Create a new directory
Let's see how to create a new directory:ls mkdir test_directory ls test_directory
Create a path of directories
Using the flag-p
we can create a path of directories, allowing us
to build more than a directory at once.
mkdir -p test_directory/subdir/subsubdirAs you can see, we are now creating two directories: one named subdir and another one, included in this, named subsubdir
The -p flag is necessary to allow the shell to create intermediate directories as required.
Create directories with specified permissions
The-m mode
option allows us to set permissions at the new directory
that we are now creating.
mkdir -m 777 test_free_directoryOur new directory will now have read,write and execute permissions for user, group and others.