Mkdir:
Role: Create directory (make directories)
Command format: Make [option] Directory
1, create the directory, when the directory exists, re-create the prompt file already exists
[Email protected]:~/linux/mkdirls[email protected]:~/linux/mkdir$ tree-D. 0 directories[email protected]:~/linux/mkdirmkdir a[email protected]: ~/linux/mkdirlsa[email protected]:~/linux/mkdirmkdir amkdir: Cannot create directory ' a ': File exists
2, you can create multiple catalogs at once
[Email protected]:~/linux/mkdirlsa[email protected]:~/linux/mkdirmkdir b C d[email protected]:~/linux/mkdirlsa b c D
3, when the parent directory of a directory does not exist, you need to use-p recursion to create
[Email protected]:~/linux/mkdir $ a b C d[email protected]: ~/linux/ mkdir $ mkdir e/ test mkdir : Cannot create directory ' E/test ': No such ~/linux/mkdir $ ls a b C d[email protected]: ~/linux/mkdir $ mkdir -P E/test[email protected]: ~/linux/mkdir $ tree.├──a├──b├──c├──d└──e└──test
4,-v output to create a directory procedure details
[Email protected]:~/linux/mkdir$mkdirF/A/B/C-PVmkdir: Created Directory'F'mkdir: Created Directory'f/a'mkdir: Created Directory'f/a/b'mkdir: Created Directory'f/a/b/c'[email protected]:~/linux/mkdir$ tree Ff└──a└──b└──c
5, curly braces: Indicates range and expansion:
[Email protected]:~/linux/mkdir$mkdir-PV A/{b,c,d,e,f}mkdir: Created Directory'a'mkdir: Created Directory'A/ b'mkdir: Created Directory'A/ c'mkdir: Created Directory'A /d'mkdir: Created Directory'a/e'mkdir: Created Directory'a/f'[email protected]:~/linux/mkdir$ tree.└──a├──b├──c├──d├──e└──f
[Email protected]:~/linux/mkdir$mkdir-PV a/{1..Ten}mkdir: Created Directory'a'mkdir: Created Directory'A/1'mkdir: Created Directory'A/2'mkdir: Created Directory'A/3'mkdir: Created Directory'A/4'mkdir: Created Directory'A/5'mkdir: Created Directory'A/6'mkdir: Created Directory'A/7'mkdir: Created Directory'A/8'mkdir: Created Directory'A/9'mkdir: Created Directory'A/10'[email protected]:~/linux/mkdir$ tree.└──a├──1├──Ten├──2├──3├──4├──5├──6├──7├──8└──9
[Email protected]:~/linux/mkdir$mkdir-PV b/{A.. Z}mkdir: Created Directory'b'mkdir: Created Directory'b/a'mkdir: Created Directory'b/b'mkdir: Created Directory'b/c'mkdir: Created Directory'b/d'mkdir: Created Directory'b/e'mkdir: Created Directory'b/f'mkdir: Created Directory'b/g'mkdir: Created Directory'b/h'mkdir: Created Directory'b/i'mkdir: Created Directory'b/j'mkdir: Created Directory'b/k'mkdir: Created Directory'b/l'mkdir: Created Directory'b/m'mkdir: Created Directory'b/n'mkdir: Created Directory'b/o'mkdir: Created Directory'b/p'mkdir: Created Directory'b/q'mkdir: Created Directory'B/R'mkdir: Created Directory'b/S'mkdir: Created Directory'b/t'mkdir: Created Directory'b/u'mkdir: Created Directory'b/v'mkdir: Created Directory'b/w'mkdir: Created Directory'b/x'mkdir: Created Directory'b/y'mkdir: Created Directory'b/z'[email protected]:~/linux/mkdir$ tree.├──a│├──1│├──Ten│├──2│├──3│├──4│├──5│├──6│├──7│├──8│└──9└──b├──a├──b├──c├──d├──e├──f├──g├──h├──i├──j├──k├──l├ ──m├──n├──o├──p├──q├──r├──s├──t├──u├──v├──W├──x├──y└──z
Linux Common basic Commands (mkdir)