How to create multi-level directories in Linux


 description

Create a directory under test and a, b, and c directories under test2 under Linux.

 command

mkdir -p -v test/a test2/{a,c,c}

 parameter

mkdir : Create the DIRECTORY(ies), if they do not already exist.
-p, --parents : no error if existing, make parent directories as needed
-v,--verbose : print a message for each created directory

 result

mkdir: created directory 'test'
mkdir: created directory 'test/a'
mkdir: created directory 'test2'
mkdir: created directory 'test2/a'
mkdir: created directory 'test2/c'

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.