Last Updated on 2021-10-19 by Clay
We can use mkdir
command to create a new folder (directory) on Linux terminal. It is a very common command in Linux system.
For example, you can enter mkdir newFolder
on terminal, and you should be able to see the newFolder folder under the current directory.
In fact, mkdir
also has many parameters that can be set.
mkdir parameters
Parameters | Description |
---|---|
-m, –mode=MODE | Set file mode, jut like chmod |
-p, –parents | Can create multi-level folder directories (parent directories that don’t exist yet will be created automatically) |
-v, –verbose | Show creation message |
–help | Show help message |
–version | Show version message |
The most common parameter should be -p
. We can use the following command to build a 4-level folders.
mkdir -p dir_1/dir_2/dir_3/dir_4