命令行的展开

~: 展开为用户的主目录

~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. 图像标注工具labelImg安装记录

    这里仅记载下labelImg的安装过程,因为有坑. 我的安装方式是从源码编译,环境ubuntu16.04,一开始是使用python2安装,从github上下载好源码,然后执行安装命令 sudo apt ...

  2. Tinkphp 教程 一

    1项目生成配置php环境变量在控制台进入项目目录,执行php console build --config build.php命令在application目录创建项目目录,把创建好的目录复制到自定义a ...

  3. poj3713 Transferring Sylla 枚举+tarjan判割点

    其实就是判断是否为三连通图 三连通图指的是去掉3个点就不连通的图,但是并没有直接求三连通的算法.著名的Tarjan算法可以求解连通和割点,再枚举删除一个点就能达到三连通的目的. 先看用例2,是由用例1 ...

  4. 2015苏州大学ACM-ICPC集训队选拔赛(2) 1001 1003 1010

    草爷要的榜 Problem Description 苏州大学代表队又勤奋地开始了训练.今天开了一场时长5小时的组队训练赛,苏州大学的n(1<=n<=100)支校队奋力拼(hua)搏(shu ...

  5. PV并发UV

    netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'返回结果:SYN_RECV 2 (SYN连接请求收到2个 等待确 ...

  6. GC:并行回收CMS详解

    CMS详解 https://www.cnblogs.com/ggjucheng/p/3977612.html CMS默认不回收Perm, 需要加参数 +CMSPermGenSweepingEnable ...

  7. java线程类图

    Executors创建不同类型的Executor, executor执行不同的runnable task Executor: Runnable:

  8. SQLServer连接查询之Cross Apply和Outer Apply的区别及用法

    https://blog.csdn.net/wikey_zhang/article/details/77480118 先简单了解下cross apply的语法以及会产生什么样的结果集吧! 示例表: S ...

  9. vue 之 nextTick 与$nextTick

    VUE中Vue.nextTick()和this.$nextTick()怎么使用? 官方文档是这样解释的: 在下次 DOM 更新循环结束之后执行延迟回调.在修改数据之后立即使用这个方法,获取更新后的 D ...

  10. vue.js请求数据(axios)

    使用npm安装axios npm install axios --save 在main.js中引入axios import axios from "axios"; 注册axios到 ...