Quick tip: Create folder with subdirectories with one command

I discovered this cool command the other day: mkdir -p …

Instead of making a parent directory and subdirectories using the command line with multiple lines by doing:

mkdir parentDir then going in it with cd parentDir then making the subdirectory with mkdir subDir. You can just do mkdir -p parentDir/subDir to do everything with a single line.

You can create as many subdirectories inside as you wish: mkdir -p parentDir/subDir/subSubDir. -> This creates a parentDir with a folder inside called subDir. subDir has a folder inside called subSubDir.

The -p is what allows you to create the sub-directories inside the parent directory. It creates the parent directory if it doesn't exist, then goes ahead and creates the subdirectories.

Want to learn how to code and make money online? Check out CodingPhase (referral link)