Files and folders

The mkdir command

Creates folders. With -p it also creates any missing parents.

Syntax

mkdir [-p] <carpeta>...

Most useful options

-pCreates the full path and does not fail if it exists
-mSets permissions when creating it

Copy-ready examples

$ mkdir practicaOne folder
$ mkdir -p proyectos/web/srcNested folders at once

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Without -p it fails if the folder already exists or a parent is missing.

Related commands

FAQ

What if the folder already exists?

Plain mkdir errors; mkdir -p does not complain.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course