--- layout: page category-title: Basic commands category-page: basic tags: directory list author: Alessandro Marinelli title: mkdir previous-page: pages/cmd/basic/ls.html next-page: pages/cmd/basic/info.html ---
The mkdir
command is used to create new directories
The 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.ls mkdir test_directory ls test_directory
-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
-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.