mkdir command

LINUX-Frequently used commands

mkdir command Creating a directory
Syntax
mkdir  [Option] [ directory]
The mkdir command is used to create a new directory with a specified name.
If it is executed with an existing directory name, an error will occur.
Frequently used options
-m  Set the access rights for the directories you create
If you create a directory with the -m option and access rights, you can create the directory with the access rights specified from the start, just as if you had run the chmod command
-p  If a non-existent intermediate directory is specified as an argument, it is also created
When creating a directory, the path in the middle of the directory to be created must be created beforehand or an error will occur.
Example: Creating a directory.
$ mkdir temp ← Create the directory "temp".
Example: Creating a directory with access rights
$ mkdir -m 755  temp2  .
$ ls  -l
drwxr-xr-x 2koro koro 3333 Mar 1 15:41 temp2    The temp2 directory has been created with access rights '755'.
Example: Create non-existent intermediate directories at the same time
$ mkdir -p dir1/dir2 ←Create dir1 and dir2 directories simultaneously.
Copied title and URL