What is mkdir -p option on linux?

 


When we use mkdir -p option, system automatically creates an intermediate directory that does not exist. If you use -p, you don’t need to make intermediate directory. Intermediate directories are created automatically. This is very useful.

# below command is not success because there is no middle directory(f1/f2) 
$ mkdir f1/f2/f3
mkdir: f1/f2: No such file or directory

# below command is success
$ mkdir -p f1/f2/f3