具体实现方式:
#切换到根目录下
root@iZ2zeakeu2oah20tpsqcp5Z:~# cd /
#在/下创建目录test
root@iZ2zeakeu2oah20tpsqcp5Z:/# mkdir test
#查看是否创建成功
root@iZ2zeakeu2oah20tpsqcp5Z:/# ll
#切换到刚创建的目录下
root@iZ2zeakeu2oah20tpsqcp5Z:/# cd test
#创建文件practice.sh
root@iZ2zeakeu2oah20tpsqcp5Z:/test# touch practice.sh
#进入vim编辑模式
root@iZ2zeakeu2oah20tpsqcp5Z:/test# vim practice.sh
#按下字母i,由“正常模式“进入到”插入模式“,编写以下三行,按下esc回到正常模式,按下“:”进入到命令模式,输入“wq”, 退出编辑模式。
#! /bin/bash
cd /test
mkdir test1
#使用ll(ls -l)命令,看当前用户是否有执行权限 如果没有 需要给当前用户添加权限
root@iZ2zeakeu2oah20tpsqcp5Z:/test# ll
#添加执行权限
root@iZ2zeakeu2oah20tpsqcp5Z:/test# chmod +x practice.sh
root@iZ2zeakeu2oah20tpsqcp5Z:/test# ll
#执行该文件 可以看到/test目录下有test1目录
root@iZ2zeakeu2oah20tpsqcp5Z:/test# ./practice.sh
root@iZ2zeakeu2oah20tpsqcp5Z:/test# ll
#查看文件大小 du命令用于显示目录或文件的大小。
#-s或--summarize 仅显示总计。
#-h或--human-readable 以K,M,G为单位,提高信息的可读性。
root@iZ2zeakeu2oah20tpsqcp5Z:/test# du -sh *
具体实现方式中的命令图片
查看文件大小的图片方式