1.当前目录下创建文件目录
mkdir 目录名
eg:
[root@LB]~# mkdir test
[root@LB]~# ls -ld test
drwxr-xr-x. 2 root root 4096 Nov 2 01:34 test
2.递归创建多级文件目录
mkdir -p 1级目录名/.../n级目录名
eg:
[root@LB]~# mkdir -p A/B/C
[root@LB]~# tree A
A
└── B
└── C
2 directories, 0 files
3.创建自定义权限的文件目录
mkdir -m 权限数 文件名
eg:
[root@LB]~# mkdir -m 4777 D
[root@LB]~# ls -ld D
drwsrwxrwx. 2 root root 4096 Nov 2 01:37 D
4.简单批量创建文件目录
mkdir 目录名相同字符串{n..m}目录名相同字符串
eg:
[root@LB]~# mkdir stu{1..10}
[root@LB]~# ls -ld stu*
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu1
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu10
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu2
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu3
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu4
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu5
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu6
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu7
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu8
drwxr-xr-x. 2 root root 4096 Nov 2 01:43 stu9
注:n,m为常量,且n<=m
时间: 2024-10-30 02:46:55