Skip to content

[Linux] Use mkdir Command to Create a Folder (Directory)

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

ParametersDescription
-m, –mode=MODESet file mode, jut like chmod
-p, –parentsCan create multi-level folder directories (parent directories that don’t exist yet will be created automatically)
-v, –verboseShow creation message
–helpShow help message
–versionShow 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

References


Read More

Tags:

Leave a ReplyCancel reply

Exit mobile version