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. 巧用SimpleDateFormat将Date类型数据按照规定类型转换。

    在使用SimpleDateFormat之前,我们来了解一下这个类.SimpleDateFormat is a concrete class for formatting and parsing dat ...

  2. 170826-关于spring的知识点及练习

    1.Spring作用: 1.生态体系庞大,全能型选手![springmvc是其一个子模块,jdbcTemplate能直接操作数据库!] 2.将其他组件粘合在一起 3.IOC容器和AOP[Aspect ...

  3. mui初级入门教程(五)— 聊聊即时通讯(IM),基于环信 web im SDK

    文章来源:小青年原创发布时间:2016-06-15关键词:mui,环信 web im,html5+,im,页面传值,缓存转载需标注本文原始地址: http://zhaomenghuan.github. ...

  4. fengmiantu3

  5. [git] 如何处理push失败的commit

    在使用git及github时,遇到一个问题:commit了一个超过100M的大文件,然后在push时失败,然后就再也无法push了,本地大文件删除了,再commit,再push也还是提示有大文件提交. ...

  6. 九、MySQL报错( (1292, u"Truncated incorrect DOUBLE value: '424a000000066'") result = self._query(query))

    1.数据库sql语句:SELECT seat_id FROM netsale_order_seat os join netsale_order nor on os.order_code=nor.ord ...

  7. Oracle 11g客户端下载地址

    Oracle 11g客户端下载地址: http://www.cr173.com/soft/36349.html

  8. Java面试中hashCode()与equals(Object obj)方法关系的准确回答

    原文地址: https://blog.csdn.net/qq_19260029/article/details/77917925 hashCode()与equals(Object obj)都是Java ...

  9. 【MM系列】SAP ABAP BAPI 和 RFC 的区别

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP BAPI 和 ...

  10. LeetCode——28. Implement strStr()

    题目: class Solution { public: int strStr(string haystack, string needle) { if(needle.empty()){ return ...