mkdir Creating a directory
1 , command format
mkdir [option] < Directory name A..
2 , command functions
through mkdir command can be created at the specified location to &NBSP; dirname ( filename specified ) name the folder or directory. The user who creates the folder or directory must have write permissions to the parent folder of the folder that is created.
the same directory cannot have the same name ( case Sensitive ) Files and directories .
3 , common parameters
- m, set permissions < mode > ( similar chmod)
-P, The directory before the directory is created does not exist, first create a parent directory , which is to create the parent directory before creating the directory
-V, Displays information each time a new catalog is created
--help Display this help message and exit
--version output version information and exit
4. Common examples
Example 1 : Created in current directory Test Catalogue
command: mkdir Test
[Email protected] ~]# mkdir test[[email protected] ~]# ls-d test/test/[[email protected] ~]#
Example 2 : Created in current directory 1/2/3 directory, if the parent directory does not exist, create a parent directory first
command: MKDIR-PV1/2/3
[[email protected] ~]# MKDIR-PV 1/2/3mkdir:created directory ' 1 ' mkdir:created directory ' "mkdir:created directory ' 1/2/3 '
Example 3 : In /tmp/ under Create logs Catalogue
command: Mkdir/tmp/logs
[Email protected] ~]# mkdir/tmp/logs[[email protected] ~]# ll-d/tmp/logs/drwxr-xr-x. Root root 4096 Dec 1 20:53/tmp/logs/
Example 4 : Under the current directory, create a permission of 777 of the test1 Catalogue
command: mkdir-m 777 Test1
[Email protected] ~]# mkdir-m 777 Test1[[email protected] ~]# ll-d test1/drwxrwxrwx. 2 root root 4096 Dec 7 20:45 test1/[[email protected] ~]#
Example 5 : One command to create multiple directories, using the command line to expand the implementation
create Mylinux/usr/local/bin,mylinux/usr/local/sbin Mylinux/etc/systconfig MYLINUX/ETC/INIT.D Mylinux/bin Mylinux/sbin
command: MKDIR-PV Mylinux/{usr/local/{bin,sbin},etc/{sysconfig,init.d},bin,sbin}
Tip: Command-line expansion Mkdir{test1,test2} ; Create a directory test1 and Directories test2
[[Email protected] ~]# mkdir -pv /tmp/mylinux/{usr/local/{bin,sbin},etc/{sysconfig, init.d},bin,sbin}mkdir: created directory ' Mylinux ' mkdir: created directory ' Mylinux/usr ' mkdir: created directory ' mylinux/usr/local ' mkdir: created directory ' Mylinux/usr/local/bin ' mkdir: created directory ' Mylinux/usr/local/sbin ' mkdir: created directory ' mylinux/etc ' mkdir: created directory ' mylinux/etc/sysconfig ' mkdir: created directory ' mylinux/etc/init.d ' mkdir: created directory ' Mylinux/bin ' mkdir: created directory ' Mylinux/sbin ' [[email protected] ~]# tree mylinux/mylinux/├── bin├── etc│ ├──init.d│ └──sysconfig├── sbin└── usr └── local ├── bin └── sbin&nbSp;9 directories, 0 files
This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1880483
One day a linux Base command Directory Management Class command mkdir