One linux command every day (4): mkdir command

Source: Internet
Author: User
One linux command every day (4): mkdir command link: One linux command every day (1): ls command http://www.2cto.com/ OS /201210/163049.html#linuxlinuxcommand every day (2): cd command complete.
One linux command every day (4): mkdir command link: One linux command every day (1): ls command http://www.2cto.com/ OS /201210/163049.html#linuxlinuxcommand every day (2): cd command terminal (3 ): the pwd command http://www.2cto.com/ OS /201210/163462.html linux mkdir command is used to create a directory with the specified name, requiring the user who creates the directory to have write permission in the current directory, the specified directory name cannot be an existing directory in the current directory. 1. command format: mkdir [option] Directory... www.2cto.com 2. command function: you can use the mkdir command to create a folder or directory named by DirName at a specified location. To create a folder or directory, you must have the write permission on the parent folder of the created folder. In addition, the created folder (directory) cannot have the same name as the file name in its parent directory (that is, the parent folder), that is, the same directory cannot have the same name (case sensitive ). 3. command parameters:-m, -- mode = mode, set permissions <模式> (Similar to chmod), rather than rwxrwxrwx minus umask-p, -- parents can be a path name. In this case, if some directories in the path do not exist, after this option is added, the system will automatically create those directories that do not exist, that is, multiple directories can be created at a time;-v, -- verbose displays information every time a new directory is created -- help displays this help information and exits -- version outputs version information and exits www.2cto.com 4. command instance: instance 1: Create an empty directory command: mkdir test1 output: [root @ localhost soft] # cd test [root @ localhost test] # mkdir test1 [root @ localhost test] # ll total 4drwxr-xr-x 2 root 4096 10-25 test1 [root @ localhost test] # www.2cto.com instance 2: recursively create multiple directory commands: mkdir-p test2/test22 output: [root @ localhost test] # mkdir-p test2/test22 [root @ localhost test] # ll total 8drwxr-xr-x 2 root 4096 10-25 test1drwxr-xr-x 3 root 4096 10-25 test2 [root @ localhost test] # cd test2/[root @ localhost test2] # ll total 4drwxr-xr-x 2 root 4096 10-25 test22 [root @ localhost test2] # www.2cto.com instance 3: run the mkdir-m 777 test3 command to create a directory with the permission of 777. the output is as follows: [root @ localhost test] # mkdir-m 777 test3 [root @ localhost test] # ll total 12drwxr-xr-x 2 root 4096 10-25 test1drwxr-xr-x 3 root 4096 10-25 test2drwxrwxrwx 2 root 4096 10-25 test3 [root @ localhost test] # description: test3 permission: rwxrwxrwx instance 4: When a new directory is created, information is displayed. Command: mkdir-v test4 output: [root @ localhost test] # mkdir-v test4mkdir: directory "test4" [root @ localhost test] # mkdir-vp test5/test5-1mkdir: Directory "test5" mkdir: you have created a directory named "test5/test5-1" [root @ localhost test] # www.2cto.com instance 5: a command to create the directory structure of the project command: mkdir-vp scf/{lib/, bin /, doc/{info, product}, logs/{info, product}, service/deploy/{info, product} output: [root @ localhost test] # mkdir-vp scf/{lib/, bin/, doc/{info, product}, logs/{info, product }, service/deploy/{info, product} mkdir: you have created the directory "scf" mkdir: you have created the directory "scf/lib" mkdir: you have created the directory "scf/bin" mkdir: you have created the "scf/doc" mkdir: you have created the "scf/doc/info" mkdir: you have created the "scf/doc/product" mkdir: you have created the "scf/logs" mkdir: you have created the "scf/logs/info" mkdir: you have created the "scf/logs/product" mkdir: you have created the "scf/service" mkdir: you have created the "scf/service/deploy" mkdir: you have created the "scf/service/deploy/info" mkdir Directory: you have created a directory named "scf/service/deploy/product" [root @ localhost test] # tree scf/| -- bin | -- doc | -- info | '-- product | -- lib | -- logs | -- info | '-- product' -- service' -- deploy | -- info' -- product12 directories, 0 files [root @ localhost test] #

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.