命令行的展开

~: 展开为用户的主目录

~USERNAME: 展开为指定用户的主目录

{}:可承载一个以逗号分隔的列表,并将其展开为多个路径

[root@host01 tmp]# mkdir   -vp /tmp/{china/{Beijing,Shanghai},usa,english}
mkdir: created directory `/tmp/china'
mkdir: created directory `/tmp/china/Beijing'
mkdir: created directory `/tmp/china/Shanghai'
mkdir: created directory `/tmp/usa'
mkdir: created directory `/tmp/english'

命令的执行结果状态

bash使用特殊变量$? 保存最后一条命令的执行状态结果

1)成功 0

2)失败 1-255

[root@host01 tmp]# mkdir /tmp/test
[root@host01 tmp]# echo $? [root@host01 tmp]# mkdir /tmp/test
mkdir: cannot create directory `/tmp/test': File exists
[root@host01 tmp]# echo $? [root@host01 tmp]#

程序执行有两类结果

1)程序的返回值

2)程序的运行状态结果(只有两种状态)

mkdir 创建目录

-p:同时创建父目录

-v:显示创建过程

-m MODE : 创建目录时直接指定权限

[root@host01 ~]# mkdir /tmp/a
[root@host01 ~]# mkdir /tmp/a/b/c
mkdir: cannot create directory `/tmp/a/b/c': No such file or directory
[root@host01 ~]# mkdir -pv /tmp/a/b/c #路径不存在的目录创建时会报错,要加-p参数将想应的路径一起创建
mkdir: created directory `/tmp/a/b'
mkdir: created directory `/tmp/a/b/c'
[root@host01 ~]# tree /tmp/
/tmp/
├── a
│   └── b
│   └── c
└── yum.log directories, file
[root@host01 ~]# ls -d /tmp/a/
/tmp/a/
[root@host01 ~]# ll -d /tmp/a/
drwxr-xr-x. root root Aug : /tmp/a/
[root@host01 ~]# mkdir -m /tmp/a/a1 #mkdir -m 权限 路径 创建指定权限的目录
[root@host01 ~]# ll -d /tmp/a/a1/
drw-r--r--. root root Aug : /tmp/a/a1/
[root@host01 ~]# mkdir  -v  {x,y}-{a,b}
mkdir: created directory `x-a'
mkdir: created directory `x-b'
mkdir: created directory `y-a'
mkdir: created directory `y-b'
[root@host01 ~]# ls
anaconda-ks.cfg install.log install.log.syslog x-a x-b y-a y-b
[root@host01 ~]# rmdir {x,y}-{a,b} -v
rmdir: removing directory, `x-a'
rmdir: removing directory, `x-b'
rmdir: removing directory, `y-a'
rmdir: removing directory, `y-b'
[root@host01 ~]#

rmdir  删除空目录

[root@host01 tmp]# ls
a yum.log
[root@host01 tmp]# rmdir -v a/
rmdir: removing directory, `a/'
rmdir: failed to remove `a/': Directory not empty
[root@host01 tmp]# ll ./a/
total
drw-r--r--. root root Aug : a1
drwxr-xr-x. root root Aug : b
[root@host01 tmp]# rmdir /tmp/a/a1/
a/ .ICE-unix/ yum.log
[root@host01 tmp]# rmdir /tmp/a/a1/
a/ .ICE-unix/ yum.log
[root@host01 tmp]# rmdir /tmp/a/a1/ -v
rmdir: removing directory, `/tmp/a/a1/'
[root@host01 tmp]#

tree

-d:只显示目录

-L level : 指定显示的层级数目

-P  pattern  :只显示由指定pattern匹配到的路径

[root@host01 tmp]# tree -d  /boot/
/boot/
├── efi
│   └── EFI
│   └── redhat
├── grub
└── lost+found directories
[root@host01 tmp]# tree -L /boot/
/boot/
├── config-2.6.-.el6.x86_64
├── efi
├── grub
├── initramfs-2.6.-.el6.x86_64.img
├── lost+found
├── symvers-2.6.-.el6.x86_64.gz
├── System.map-2.6.-.el6.x86_64
└── vmlinuz-2.6.-.el6.x86_64 directories, files
[root@host01 tmp]#

linux基础命令-mkdir/tree/rmdir的更多相关文章

  1. Linux基础命令mkdir

    mkdir  /home/ceshi   home目录下创建测试目录 mkdir  -p  /home/ceshi1/ceshi home目录下递归创建 mkdir     /home/ceshi2  ...

  2. Linux基础命令-mkdir

    mkdir 作用:创建目录 主要参数:-p $ cd /home/test $ mkdir caianchun $ ls caianchun -p:递归参数 $ mkdir caianchun2/1/ ...

  3. Linux基础命令小结(超全!!)

    Linux目录结构 1.bin 存放经常使用的指令比如ll,cp 2.sbin 系统管理员使用的系统管理指令 3.home 存放普通用户的住目录 4.root 系统管理员的用户主目录 5.boot 存 ...

  4. Linux 基础命令及基本目录

    Linux 基础命令及基本目录 一.网卡 1.网卡配置文件路径 ​ /etc/sysconfig/network-scripts/ifcfg-eth0 配置文件: TYPE=Ethernet # 以太 ...

  5. 第四节,Linux基础命令

    第四节,Linux基础命令 命令是系统操作员对系统传入的指令,传入指令后回车,系统接收到指令做出相应的行为 1.查看用户位于系统什么位置 [pmd]检查操作用户位于系统的什么位置 命令         ...

  6. 【Python之路】第一篇--Linux基础命令

    pwd 命令 查看”当前工作目录“的完整路径 pwd -P # 显示出实际路径,而非使用连接(link)路径:pwd显示的是连接路径 .   表示当前目录 ..  表示上级目录 /  表示根目录 ls ...

  7. 2.Linux基础命令

    linux内一切皆文件,没有文件夹只有目录,目录也是一种文件 1.一些常用按键: 将鼠标的光标从虚拟机里切换回来:Ctrl+Alt 拖动Ubuntu内的对话框:Alt键+鼠标左键拖动 清屏:Ctrl+ ...

  8. linux基础命令:

    linux基础命令: 显示 echo 输出我写的内容 ls 查看当前目录的文件 pwd 查看当前目录 ifconfig 查看网卡信息 grep 过滤 -v 取反 -n man 查看命令的帮助信息 md ...

  9. 常用的linux基础命令

    常用的linux基础命令 1.ls 显示目录属性 -l:(也可以简写成ll),列表显示权限等属性 -a:显示所有文件包括隐藏文件等 -d:只列出目录本身 2.chgrp 改变档案所属群组 eg:chg ...

随机推荐

  1. A. Wrong Subtraction

    A. Wrong Subtraction time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. day15 面向对象 成员

    成员 1. 变量 1.实例变量 格式: 变量.xxx=xx (称为实例变量,也叫属性,字段)给对象用的 2.类变量 类变量:直接写在类中的变量就是类变量,类变量一般用类名来访问 其实就是类中相同的属性 ...

  3. 阿里Java开发规约(2)

    本文是对阿里插件中规约的详细解释二,关于插件使用,请参考这里 及时清理不再使用的代码段或配置信息. 说明:对于垃圾代码或过时配置,坚决清理干净,避免程序过度臃肿,代码冗余 Positive examp ...

  4. 5.监听器(Listener)

    1.监听器简介: 监听器主要用来监听对象的创建,属性的变化,是一个实现特定接口的普通Java类. Listener接口与事件对应表: 与 ServletContext 有关 ServletContex ...

  5. Windows无法启动 VMware Workstation server服务解决方法

    Windows无法启动VMware Workstation server服务, 可以通过删除datastores.xml文件来解决. 具体操作步骤如下: 1.在系统盘目录下,找到C:\ProgramD ...

  6. robotFramework接口测试GET和POST请求

    安装: 接口测试需要安装Request和RequestLibrary 包 使用cmd命令安装:pip install requests 使用cmd命令安装:pip install -U robotfr ...

  7. 2018.6.1学习CSS5里顺丰盒子小问题

    在制作下面这样的小盒子时 编写的代码 首先要对li元素设置浮动. 在设置这个li元素下面的a元素时, 因为没有转行内块,inline-block,结果显示出来的页面,鼠标在经过这个选择时(:hover ...

  8. inventor卸载不干净

    AUTODESK系列软件着实令人头疼,安装失败之后不能完全卸载!!!(比如maya,cad,3dsmax等).有时手动删除注册表重装之后还是会出现各种问题,每个版本的C++Runtime和.NET f ...

  9. zookeeper开源客户端curator

    zookeeper的原生api相对来说比较繁琐,比如:对节点添加监听事件,当监听触发后,我们需要再次手动添加监听,否则监听只生效一次:再比如,断线重连也需要我们手动代码来判断处理等等.对于curato ...

  10. 解决dede图集上传图片时跳出302错误

    错误.以前从来没遇到过,想了半天也没想出是哪里出了错误,郁闷~ 没辙,去论坛搜了一下,还真有同命相连的兄弟,同样爆出这个错误.往下拉了几楼,还是找到了答案. 解决办法是: 在include/userl ...