Creating Multiple Directories on the Linux CLI

I recently learned something while going through the puppet tutorial VM and I want to share it and document it to remind myself in the future.

You may know that you create directories on the Linux Command Line (CLI) with:

mkdir new-dir

While I'm not yet sure how wide spread this is (different distrubtions have different support for different features you can try the following to create two directoreis at once:

mkdir -p pasture/{manifests,files}

This create the folder pasture with two subdirectories: manifests and files. The -p switch indicates creating the parent directory if needed.

Frank Villasenor

Frank Villasenor

Owner and principal author of this site. Professional Engineering Lead, Software Engineer & Architect working in the Chicagoland area as a consultant. Cert: AWS DevOps Pro
Chicago, IL