Linux mkdir Command

Linux 命令大全Linux Command Reference

The Linux mkdir (full English spelling: make directory) command is used to create directories.

Syntax

mkdir [-p] dirName

Parameter Description:

  • -p Ensures the directory name exists; if it does not exist, create one.

Examples

In the working directory, create a subdirectory named example:

mkdir example

In the example2 directory under the working directory, create a subdirectory named test.

If the example2 directory does not originally exist, create one. (Note: In this example, if the -p parameter is not added and the example2 directory does not originally exist, an error will occur.)

mkdir -p example2/test

Linux 命令大全Linux Command Reference

Other Extensions