Low Orbit Flux Logo 2 F

Linux How To Create A Directory

Creating a directory on Linux is easy.

You can create a directory like this:


mkdir test1

You can create a subdirectory inside another directory like this. If the parent directory doesn’t exist you will receive an error.


mkdir test1/abc1

If you want to create a directory and subdirectory recursively in one command you can specify the “-p” option. This will create the parent directory if needed./


mkdir -p test2/test3

With the “-p” option you can create subdirectories as deep as you would like.


mkdir -p test2/test3/asdf/test/jkl

You can also specify an absolute path like this:


mkdir -p /home/user1/test12/test123/testabc