In this article, we are going to see how to check whether a directory is that or not in terminal and create the directory if not already there.
For this, then you can use the following command :
$ [ -d yourdirectory ] || mkdir yourdirectory
This is similar to an if condition. First it will check whether there is a directory name “yourdirectory” in the current path and if the directory is there, then it will do nothing. But if the directory is not there, it will create the directory.