Create Nested Directories using mkdir Command

If you use the mkdir to create a directory inside a directory you would get an error,

# mkdir dir1/dir2
mkdir: cannot create directory 'dir1/dir2': No such file or directory 

To create a nested directories like dir1/dir2 you need to pass in an optional argument -p or --parents along with it.

# mkdir -p dir1/dir2/dir3

Create nested directories using mkdir command

Have Questions? Post them here!

Top Hashtags: