1. 命令功能

  tree中文意思“树”,以树形结构显示目录内容。、

2. 语法格式

  tree  [option]   [directory]

  tree  选项   目录

3. 使用范例

当最小化安装linux时,是没有安装tree命令的。

范例1 : 不带参数执行tree,显示/bin下内容

[root@localhost home]#

[root@localhost home]# cd /bin

[root@localhost bin]# tree

.

├── arch

├── awk -> gawk

├── basename

├── bash

├── cat

范例2:显示/home/cxf目录下全部目录树

[cxf@localhost ~]$ tree -a

.

├── abc

├── .bash_history

├── .bash_logout

├── .bash_profile

├── .bashrc

├── .lesshst

├── old

│   ├── a

│   ├── b

范例3:只列出目录的目录树

[cxf@localhost ~]$ tree -d

.

├── old

│   ├── a

│   ├── b

│   ├── c

范例4:显示文件的全路径

[cxf@localhost ~]$ tree -f

.

├── ./abc

└── ./test

├── ./test/dir1

├── ./test/dir2

├── ./test/dir3

├── ./test/dir4

└── ./test/dir5

6 directories, 1 file

[cxf@localhost ~]$ tree -f /home/cxf

/home/cxf

├── /home/cxf/abc

└── /home/cxf/test

├── /home/cxf/test/dir1

├── /home/cxf/test/dir2

├── /home/cxf/test/dir3

├── /home/cxf/test/dir4

└── /home/cxf/test/dir5

6 directories, 1 file

范例5:显示2层目录树

[cxf@localhost ~]$ tree -L 2

.

├── abc

└── test

├── dir1

├── dir2

├── dir3

├── dir4

└── dir5

6 directories, 1 file

[cxf@localhost ~]$ tree -L 2 --noreport

.

├── abc

└── test

├── dir1

├── dir2

├── dir3

├── dir4

└── dir5

tree 数状型结构显示目录下的内容的更多相关文章

  1. tree:以树形结构显示目录下的内容

    tree命令 1.命令详解 [功能说明] tree命令的中文意思为“树”,功能是以树形结构列出指定目录下的所有内容包括所有文件.子目录及子目录里的目录和文件. [语法格式] tree [option] ...

  2. ls 显示目录下的内容和文件相关属性信息

    1.命令功能 ls命令是“list directory contents”,显示当前目录下的内容和文件属性. 2.语法格式 ls  [option]  file ls  选项  文件名 3.选项说明 ...

  3. 显示目录下的内容--ls

    ls               显示当前目录下的所有文件或者文件夹,但不包括 . 和 .. ls -a                  显示当前目录下的所有文件或者文件夹 ls -l        ...

  4. php删除目录及目录下的内容

    今天遇到一个问题: java写的API,ppt转图片生成的目录和文件 在使用php调用API完成后,再使用php进行删除时,遇到了删除失败的问题 部署的环境是Ubuntu 导致删除失败的原因是权限的问 ...

  5. linux下怎么用tree命令以树形结构显示文件目录结构?

    tree命令以树状图列出文件目录结构.不过某些Linux上(Centos 6.4)没有tree命令,本文将介绍安装方法. 常用参数: ? 1 2 3 4 5 6 tree -d 只显示目录.   tr ...

  6. 【转】linux tree命令以树形结构显示文件目录结构 ---- 不错

    原文网址:http://jingyan.baidu.com/article/acf728fd19c7eff8e510a3eb.html 今天小编来给分享Linux 系统下一个非常有用的命令的使用:tr ...

  7. java 显示目录下全部文件

    package gao.org; import java.awt.HeadlessException; import java.io.File; import javax.swing.JFileCho ...

  8. php 数组变成树状型结构

    <? php $stime = microtime(true); $nodes = [ ['id' = > 1, 'pid' = > 0, 'name' = > 'a'], [ ...

  9. linux du 显示目录下的各个子目录的大小

    use  command du  display estimate file space usage size of subdirectories [oracle@ahjcyl-db backup]$ ...

随机推荐

  1. Spring Cloud架构教程 (六)消息驱动的微服务【Dalston版】

    Spring Cloud Stream是一个用来为微服务应用构建消息驱动能力的框架.它可以基于Spring Boot来创建独立的.可用于生产的Spring应用程序.它通过使用Spring Integr ...

  2. 滑动报 Unable to preventDefault inside passive event listener due to target being treated as passive 的解决方法

    google浏览器滑动出现以下问题: 解决办法如下:在html元素下添加样式 touch-action: none; html{ touch-action:none; }

  3. Solr单机环境搭建及部署

    一.定义 官网的定义: Solr是基于Lucene构建的流行,快速,开放源代码的企业搜索平台.它具有高度的可靠性,可伸缩性和容错能力,可提供分布式索引,复制和负载平衡查询,自动故障转移和恢复,集中式配 ...

  4. 深入JavaWeb技术世界15:深入浅出Mybatis基本原理

    本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial 喜欢的话麻烦点下 ...

  5. fengmiantu---

  6. kvm中添加VNC密码

      #virsh edit 虚机名 <graphics type='vnc' port='5901' autoport='no' listen='0.0.0.0' keymap='en-us'/ ...

  7. Booting the Linux/ppc kernel without Open Firmware

    The DT block format 这一章定义了传递给内核的FDT(flattened device tree)的格式.关于它包含的内容以及内核需要的属性将在后续章节描述. 注:DT block应 ...

  8. RocketMQ 创建和删除 topic,以及 broker 和 nameserver 之间的心跳

    命令行主类:org.apache.rocketmq.tools.command.MQAdminStartup 客户端创建 topic 程序参数:updateTopic -n localhost:987 ...

  9. 剑指offer(2):字符串

    C语言中的字符串 C语言中字符串的存储方式和数组类似,都是连续定长的内存块.字符串数组以\0结尾,所以会比正常数组多一位,char str3[5] = "1234"; //此处赋值 ...

  10. Mac--PHP已经开启gd扩展验证码不显示

    错误显示:Call to undefined function imagettftext() 原因: mac系统中自带的php的gd库中,缺少对freetype的支持,导致图片无法显示. 解决: 1 ...