mkdir

The shell command that makes a new directory; with -p it also makes missing parent directories and does not complain if the directory already exists.

In more detail

The -p flag makes mkdir safe to repeat, because it does not fail when the directory already exists. It creates an empty folder and nothing else.

Examples

mkdir -p by-hand
The Ansible file module with state: directory is the idempotent equivalent and reports whether it changed anything.
mkdir -p project/src/lib
mkdir my-project && cd my-project && git init

Related terms

Taught in

References

Certification courses