Linux Step---mkdir command

Source: Internet
Author: User
Tags create directory parent directory

1 command function (brief description):

Used to create a directory that requires the user who needs to create the directory to have write permissions in the current directory, and that the new directory cannot be a directory that already exists for the current directory.

2 Command syntax:

mkdir the contents of the "Options" directory name #注: "Are non-mandatory options

3 command options (only common command parameters are described):

Use the help command: Man mkdir or Mkdir-help

-M,--mode==mode set permissions, here Use the help command to derive (set file mode (as in chmod), not a=rwx-umask) do not understand this string of English say what meaning???

-P,--Parents to create a directory recursively, even if the parent directory exists and does not error

-V,--verboe detailed print out all the created directory details

-Z,--context=ctx (Set the SELinux security context of each created directory to CTX) This is a string of description of what the meaning is not very understanding???

 

4 Usage Examples:

  (1) mkdir directory name ", directory name"

#multiple catalogs can be created at once[[email protected] command_test]#mkdir dir1 dir2 dir3[[email protected] command_test]#llTotal Dosage 12drwxr-xr-x. 2 root root 4096 July 25 04:22DIR1DRWXR-xr-x. 2 root root 4096 July 25 04:22DIR2DRWXR-xr-x. 2 root root 4096 July 25 04:22Dir3#Create a directory name with spaces, but it is not recommended[[email protected] command_test]#mkdir "Dir4 xx"[[email protected] command_test]#llTotal dosage 16drwxr-xr-x. 2 root root 4096 July 25 04:22DIR1DRWXR-xr-x. 2 root root 4096 July 25 04:22DIR2DRWXR-xr-x. 2 root root 4096 July 25 04:22DIR3DRWXR-xr-x. 2 root root 4096 July 04:22 dir4 xx

  (2) mkdir-m directory name Create directory and set permissions

# Bulk Set Permissions [[email protected] command_test] # mkdir-m 777 Dir5 DIR6 dir7 [[email protected] command_test] # ll total dosage2 root root 4096 July  04:252 root root 4096 July  04:252 root R oot 4096 July  04:25 dir7

 #   Note the normal creation of directories with the-m parameter setting permissions to create directory differences  [root  @localhost command_test]#   mkdir dir1  [[email protected] Command_test]#   ll  Total dosage 4drwxr -xr-x. 2 root root 4096 July 03:53 dir1[root  @localhost command_test]#   mkdir-m 777 Dir2  [[email protected] Command_test]#   ll  total usage 8drwxr -xr-x. 2 root root 4096 July 03:53 dir1drwxrwxrwx.  2 root root 4096 July 03:53 Dir2 
[[email protected] command_test] # mkdir--mode a=rwx-w dir1 [[email protected] command_test] # ll Total dosage 4Dr-xr-xr-x. 2 root root 4096 July  03:59 Dir1
# Note the following uses the u= owner, g= belongs to the group, o= other users [[email protected] command_test] #  [[email protected] command_test]#  ll total dosage 4drw-RW----. 2 root root 4096 July  04:03 Dir2

  (3) MKDIR-PV directory name recursively create directory and output directory details

#The following are examples of creating a directory recursively[[email protected] command_test]#MKDIR-PV dir1/dir2/dir3mkdir: Directory Created"Dir1"mkdir: Directory created"Dir1/dir2"mkdir: Directory created"Dir1/dir2/dir3"[Root@localhost Command_test]#CD Dir1[Email Protected]lhost Dir1]#CD Dir2[[email protected] DIR2]#CD Dir3
#just touching the following two commands feels particularly interesting[[email protected] command_test]#MKDIR-PV Test1/{test2,test3/{test4,test5}}mkdir: Directory Created"test1"mkdir: Directory created"Test1/test2"mkdir: Directory created"Test1/test3"mkdir: Directory created"Test1/test3/test4"mkdir: Directory created"Test1/test3/test5"[Root@localhost Command_test]#MKDIR-PV DIR1/{DIR2,DIR3}/{DIR4,DIR5}mkdir: Directory Created"Dir1"mkdir: Directory created"Dir1/dir2"mkdir: Directory created"DIR1/DIR2/DIR4"mkdir: Directory created"DIR1/DIR2/DIR5"mkdir: Directory created"Dir1/dir3"mkdir: Directory created"DIR1/DIR3/DIR4"mkdir: Directory created"DIR1/DIR3/DIR5"

Linux Step---mkdir command

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.