Today we will introduce the fourth command: mkdir. mkdir (Make directory creates a directory): Creates a directory if the specified directory does not exist. When you create a directory, you are asked to write permissions for the user who created the directory, and you should ensure that the new directory does not have duplicate names.
Usage:mkdir [options] ... Directory...
by default, running the mkdir command without any parameters creates a directory under the current directory.
From what we've seen, we've created a name of office mkdir command, we are in /home/ Pungki directory. So this new directory office created in /home/pungki If we use absolute path - example: /usr/local - then linux /usr/local
when Linux discovers that the directory you want to create already exists , linux will prompt us that Linux cannot create it.
another first condition for creating a directory is that you must have access to the destination path where you want to create the directory . mkdir will report this error when you are unable to get permission.
Options
Example
We can also create multiple directories at the same time. For example, the directory we are creating is Ubuntu, Redhat and slackware. Then the syntax would look like this :
when you want to create a directory that contains subdirectories, you need to use the- p parameter. If mkdir cannot find the parent directory, this parameter first helps to create the parent directory. For example, we want to Create a directory named Letter , which contains subdirectories important in its directory . Then the syntax would look like this:
Use - M parameter, we can set permissions for the new directory that is about to be generated. Examples are as follows:
The above command creates a directory named letter, giving read-only permissions to directory owners, user groups, and other users for the directory
If we want to view the information, we can use - v parameters to implement. Examples are as follows:
The Mkdir command also belongs to the most basic command, which must be mastered for a friend who wants to learn Linux. As usual, you can type man mkdir or mkdir--help to show mkdir 's manual page and more in-depth discussion.
Well, today we'll introduce this, next time we continue to learn the common command five: rmdir command.
Jerry Education
Source:http://www.cnblogs.com/jerehedu/
Copyright Notice: The copyright of this article belongs to cigarettes DeskJerry EducationSection Technology Co., Ltd. and blog Park are shared, welcome reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.
Technical Consultation:
Linux common Commands (iv)--MKDIR