Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the mkdir (make directory) command. It’s one of the basic commands that every Linux user ought to know, but there are some rules and a couple options that aren’t obvious.
First, to create a directory, you need to have write access to the directory that will contain it. If you’re creating the new directory in your home directory, no problem.
The directory will belong to you and be associated with your primary group and be assigned some default permissions.
To create a directory in another location, you need to provide the path:
If you want to create a directory structure – for example directory c inside directory b inside directory c in your current location, you can add an option that lets you create all of the required directories in a single command. Use -p to create the directory’s “parents”.
If you want to create a directory with particular permissions, you can specify the permissions you want to apply with the -m option.
This would create a directory that only allows you read, write and execute permissions.
That’s your Linux tip for the mkdir command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.