“mkdir” command tips and tricks

Create a normal directory ( folder )

mkdir myroot

Create multiple directories at once

mkdir dir1 dir 2 dir3 
mkdir {dir1,dir2,dir3}
mkdir dir{1..3}
rm -d dir{1..3}

Create a directory with the current date

mkdir `date ‘+%y%m%d’`

Basic but i think useful stuff

Now let’s create some parent directories.

mkdir -p myroot/project-name/src

Now we can combine many options:

mkdir -p `date '+%y%m%d'`/{1,2,3}
20211114/1
/2
/3

That’s it for now

Let me know if you want to learn more tips and tricks from the terminal.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store