linux mkdir命令

mkdir 新建目录
-m 配制文件的权限,直接设置,不需要查看默认权限
-p 可以递归的创建相关的文件

[root@python3 mail]# cd
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# pwd
/root
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# ll
总用量 232
drwxr-xr-x. 3 root root  4096 1月  10 09:16 a
-rw-------. 1 root root  1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root  4096 1月  14 14:49 a_test1_bak
-rw-r--r--. 1 root root   391 1月  11 18:16 a.txt
drwxr-xr-x. 2 root root  4096 1月  12 08:43 b
drwxr-xr-x. 2 root root  4096 1月  12 10:20 c
d---------. 2 root root  4096 1月  12 16:03 d
drwxr-xr-x. 2 root root  4096 1月  12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root   391 1月  12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月  12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月  13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root   391 1月  12 13:24 yy.txt
drwxr-xr-x. 2 root root  4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root  4096 11月 22 2022 模板
drwxr-xr-x. 2 root root  4096 11月 22 2022 视频
drwxr-xr-x. 2 root root  4096 11月 22 2022 图片
drwxr-xr-x. 2 root root  4096 11月 22 2022 文档
drwxr-xr-x. 2 root root  4096 11月 22 2022 下载
drwxr-xr-x. 2 root root  4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root  4096 11月 22 2022 桌面
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# mkdir ab
[root@python3 ~]# ll
总用量 236
drwxr-xr-x. 3 root root  4096 1月  10 09:16 a
drwxr-xr-x. 2 root root  4096 1月  14 15:13 ab
-rw-------. 1 root root  1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root  4096 1月  14 14:49 a_test1_bak
-rw-r--r--. 1 root root   391 1月  11 18:16 a.txt
drwxr-xr-x. 2 root root  4096 1月  12 08:43 b
drwxr-xr-x. 2 root root  4096 1月  12 10:20 c
d---------. 2 root root  4096 1月  12 16:03 d
drwxr-xr-x. 2 root root  4096 1月  12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root   391 1月  12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月  12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月  13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root   391 1月  12 13:24 yy.txt
drwxr-xr-x. 2 root root  4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root  4096 11月 22 2022 模板
drwxr-xr-x. 2 root root  4096 11月 22 2022 视频
drwxr-xr-x. 2 root root  4096 11月 22 2022 图片
drwxr-xr-x. 2 root root  4096 11月 22 2022 文档
drwxr-xr-x. 2 root root  4096 11月 22 2022 下载
drwxr-xr-x. 2 root root  4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root  4096 11月 22 2022 桌面
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# mkdir ac/ad/ae
mkdir: 无法创建目录"ac/ad/ae": 没有那个文件或目录
[root@python3 ~]# mkdir -p ac/ad/ae
[root@python3 ~]# ll
总用量 240
drwxr-xr-x. 3 root root  4096 1月  10 09:16 a
drwxr-xr-x. 2 root root  4096 1月  14 15:13 ab
drwxr-xr-x. 3 root root  4096 1月  14 15:14 ac
-rw-------. 1 root root  1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root  4096 1月  14 14:49 a_test1_bak
-rw-r--r--. 1 root root   391 1月  11 18:16 a.txt
drwxr-xr-x. 2 root root  4096 1月  12 08:43 b
drwxr-xr-x. 2 root root  4096 1月  12 10:20 c
d---------. 2 root root  4096 1月  12 16:03 d
drwxr-xr-x. 2 root root  4096 1月  12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root   391 1月  12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月  12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月  13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root   391 1月  12 13:24 yy.txt
drwxr-xr-x. 2 root root  4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root  4096 11月 22 2022 模板
drwxr-xr-x. 2 root root  4096 11月 22 2022 视频
drwxr-xr-x. 2 root root  4096 11月 22 2022 图片
drwxr-xr-x. 2 root root  4096 11月 22 2022 文档
drwxr-xr-x. 2 root root  4096 11月 22 2022 下载
drwxr-xr-x. 2 root root  4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root  4096 11月 22 2022 桌面
[root@python3 ~]# cd ac
[root@python3 ac]# cd ad
[root@python3 ad]# cd ae
[root@python3 ae]# ll
总用量 0
[root@python3 ae]# 
[root@python3 ae]# cd
[root@python3 ~]# pwd
/root
[root@python3 ~]# 
[root@python3 ~]# 
[root@python3 ~]# mkdir -m 000 ad
[root@python3 ~]# ll ./ab
总用量 0
[root@python3 ~]# ll ab
总用量 0
[root@python3 ~]# ll
总用量 244
drwxr-xr-x. 3 root root  4096 1月  10 09:16 a
drwxr-xr-x. 2 root root  4096 1月  14 15:13 ab
drwxr-xr-x. 3 root root  4096 1月  14 15:14 ac
d---------. 2 root root  4096 1月  14 15:16 ad
-rw-------. 1 root root  1416 11月 22 2022 anaconda-ks.cfg
drwxrwx---. 3 root root  4096 1月  14 14:49 a_test1_bak
-rw-r--r--. 1 root root   391 1月  11 18:16 a.txt
drwxr-xr-x. 2 root root  4096 1月  12 08:43 b
drwxr-xr-x. 2 root root  4096 1月  12 10:20 c
d---------. 2 root root  4096 1月  12 16:03 d
drwxr-xr-x. 2 root root  4096 1月  12 11:20 hahaxiix.txt
-rwxr-xr-x. 1 root root   391 1月  12 11:21 hello.txt
-rw--wx---. 1 root root 46478 1月  12 10:22 install_bak.log
-rwxrwxrwx. 1 root root 46478 1月  13 16:59 install_i5bak.log
-rw-r--r--. 1 root root 46478 11月 22 2022 install.log
-rw-r--r--. 1 root root 10033 11月 22 2022 install.log.syslog
---x-w-r--. 1 root root   391 1月  12 13:24 yy.txt
drwxr-xr-x. 2 root root  4096 11月 22 2022 公共的
drwxr-xr-x. 2 root root  4096 11月 22 2022 模板
drwxr-xr-x. 2 root root  4096 11月 22 2022 视频
drwxr-xr-x. 2 root root  4096 11月 22 2022 图片
drwxr-xr-x. 2 root root  4096 11月 22 2022 文档
drwxr-xr-x. 2 root root  4096 11月 22 2022 下载
drwxr-xr-x. 2 root root  4096 11月 22 2022 音乐
drwxr-xr-x. 2 root root  4096 11月 22 2022 桌面
[root@python3 ~]# 

  • 7
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值