tree安装以及命令

tree命令以树状图列出目录的内容。

执行tree指令,它会列出指定目录下的所有文件,包括子目录里的文件。

[root@centos01 ~]# tree
bash: tree: 未找到命令...
[root@centos01 ~]# tree /usr/local/java/
bash: tree: 未找到命令...
[root@centos01 ~]#

发现系统并没有安装tree。

接下来将安装tree

[root@centos01 java]# yum install tree 
已加载插件:fastestmirror, langpacks
/var/run/yum.pid 已被锁定,PID 为 3296 的另一个程序正在运行。
Another app is currently holding the yum lock; waiting for it to exit...
  另一个应用程序是:PackageKit
    内存: 58 M RSS (413 MB VSZ)
    已启动: Sat Aug 18 16:20:14 2018 - 00:26之前
    状态  :睡眠中,进程ID:3296
Another app is currently holding the yum lock; waiting for it to exit...
  另一个应用程序是:PackageKit
    内存: 58 M RSS (413 MB VSZ)
    已启动: Sat Aug 18 16:20:14 2018 - 00:28之前
    状态  :睡眠中,进程ID:3296
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

==================================================================================================================
 Package               架构                   版本                    源                    大小
==================================================================================================================
正在安装:
 tree                  x86_64                1.6.0-10.el7            base                  46 k

事务概要
==================================================================================================================
安装  1 软件包

总下载量:46 k
安装大小:87 k
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/tree-1.6.0-10.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY       ]  0.0 B/s |    0 B  --:--:-- ETA 
tree-1.6.0-10.el7.x86_64.rpm 的公钥尚未安装
tree-1.6.0-10.el7.x86_64.rpm                                                                                                                 |  46 kB  00:00:01     
从 http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 来自       : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : tree-1.6.0-10.el7.x86_64                                                                              1/1 
  验证中      : tree-1.6.0-10.el7.x86_64                                                                              1/1 

已安装:
  tree.x86_64 0:1.6.0-10.el7                                                                                                                                                           

完毕!
[root@centos01 java]#

 

验证是否安装成功

[root@centos01 centos01]# tree
.
├── \345\205\254\345\205\261
├── \346\250\241\346\235\277
├── \350\247\206\351\242\221
├── \345\233\276\347\211\207
│   ├── houston_rockets-003.jpg
│   ├── nbalanqiuzhutizhuomianbizhi-002.jpg
│   └── Wallpapers
│       ├── houston_rockets-003.jpg
│       └── nbalanqiuzhutizhuomianbizhi-002.jpg
├── \346\226\207\346\241\243
├── \344\270\213\350\275\275
├── \351\237\263\344\271\220
└── \346\241\214\351\235\242
    ├── delete\ file
    ├── note
    └── rpm

9 directories, 7 files
[root@centos01 centos01]# 
[root@centos01 centos01]# tree --version
tree v1.6.0 (c) 1996 - 2011 by Steve Baker, Thomas Moore, Francesc Rocher, Kyosuke Tokoro 
[root@centos01 centos01]# 

 

常用选项:

-a:显示所有文件和目录;
-C:在文件和目录清单加上色彩,便于区分各种类型;
-d:先是目录名称而非内容;
-f:在每个文件或目录之前,显示完整的相对路径名称;
-s:列出文件和目录大小;

tree -d 目录

[root@centos01 centos01]# tree -d /usr/local/java
/usr/local/java
└── jdk1.8.0_181
    ├── bin
    ├── include
    │   └── linux
    ├── jre
    │   ├── bin
    │   ├── lib
    │   │   ├── amd64
    │   │   │   ├── jli
    │   │   │   └── server
    │   │   ├── applet
    │   │   ├── cmm
    │   │   ├── deploy
    │   │   ├── desktop
    │   │   │   ├── applications
    │   │   │   ├── icons
    │   │   │   │   ├── hicolor
    │   │   │   │   │   ├── 16x16
    │   │   │   │   │   │   ├── apps
    │   │   │   │   │   │   └── mimetypes
    │   │   │   │   │   └── 48x48
    │   │   │   │   │       ├── apps
    │   │   │   │   │       └── mimetypes
    │   │   │   │   ├── HighContrast
    │   │   │   │   │   ├── 16x16
    │   │   │   │   │   │   ├── apps
    │   │   │   │   │   │   └── mimetypes
    │   │   │   │   │   └── 48x48
    │   │   │   │   │       ├── apps
    │   │   │   │   │       └── mimetypes
    │   │   │   │   ├── HighContrastInverse
    │   │   │   │   │   ├── 16x16
    │   │   │   │   │   │   ├── apps
    │   │   │   │   │   │   └── mimetypes
    │   │   │   │   │   └── 48x48
    │   │   │   │   │       ├── apps
    │   │   │   │   │       └── mimetypes
    │   │   │   │   └── LowContrast
    │   │   │   │       ├── 16x16
    │   │   │   │       │   ├── apps
    │   │   │   │       │   └── mimetypes
    │   │   │   │       └── 48x48
    │   │   │   │           ├── apps
    │   │   │   │           └── mimetypes
    │   │   │   └── mime
    │   │   │       └── packages
    │   │   ├── ext
    │   │   ├── fonts
    │   │   ├── images
    │   │   │   ├── cursors
    │   │   │   └── icons
    │   │   ├── jfr
    │   │   ├── locale
    │   │   │   ├── de
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── es
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── fr
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── it
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── ja
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── ko
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── ko.UTF-8
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── pt_BR
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── sv
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── zh
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── zh.GBK
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── zh_HK.BIG5HK
    │   │   │   │   └── LC_MESSAGES
    │   │   │   ├── zh_TW
    │   │   │   │   └── LC_MESSAGES
    │   │   │   └── zh_TW.BIG5
    │   │   │       └── LC_MESSAGES
    │   │   ├── management
    │   │   ├── oblique-fonts
    │   │   └── security
    │   │       └── policy
    │   │           ├── limited
    │   │           └── unlimited
    │   └── plugin
    │       └── desktop
    ├── lib
    │   ├── amd64
    │   │   └── jli
    │   ├── missioncontrol
    │   │   ├── configuration
    │   │   │   ├── org.eclipse.equinox.simpleconfigurator
    │   │   │   └── org.eclipse.update
    │   │   ├── dropins
    │   │   ├── features
    │   │   │   ├── com.jrockit.mc.feature.console_5.5.2.174165
    │   │   │   ├── com.jrockit.mc.feature.core_5.5.2.174165
    │   │   │   ├── com.jrockit.mc.feature.flightrecorder_5.5.2.174165
    │   │   │   ├── com.jrockit.mc.feature.rcp_5.5.2.174165
    │   │   │   ├── com.jrockit.mc.feature.rcp.ja_5.5.2.174165
    │   │   │   ├── com.jrockit.mc.feature.rcp.zh_CN_5.5.2.174165
    │   │   │   ├── com.jrockit.mc.rcp.product_5.5.2.174165
    │   │   │   ├── org.eclipse.babel.nls_eclipse_ja_4.4.0.v20140623020002
    │   │   │   ├── org.eclipse.babel.nls_eclipse_zh_4.4.0.v20140623020002
    │   │   │   ├── org.eclipse.e4.rcp_1.3.100.v20141007-2033
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.ecf.core.feature_1.1.0.v20140827-1444
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.ecf.core.ssl.feature_1.0.0.v20140827-1444
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.ecf.filetransfer.feature_3.9.0.v20140827-1444
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.ecf.filetransfer.httpclient4.feature_3.9.1.v20140827-1444
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.ecf.filetransfer.httpclient4.ssl.feature_1.0.0.v20140827-1444
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.ecf.filetransfer.ssl.feature_1.0.0.v20140827-1444
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.emf.common_2.10.1.v20140901-1043
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.emf.ecore_2.10.1.v20140901-1043
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.equinox.p2.core.feature_1.3.0.v20140523-0116
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.equinox.p2.rcp.feature_1.2.0.v20140523-0116
    │   │   │   │   └── META-INF
    │   │   │   ├── org.eclipse.help_2.0.102.v20141007-2301
    │   │   │   │   └── META-INF
    │   │   │   └── org.eclipse.rcp_4.4.0.v20141007-2301
    │   │   │       └── META-INF
    │   │   ├── p2
    │   │   │   ├── org.eclipse.equinox.p2.core
    │   │   │   │   └── cache
    │   │   │   │       └── binary
    │   │   │   └── org.eclipse.equinox.p2.engine
    │   │   │       └── profileRegistry
    │   │   │           └── JMC.profile
    │   │   └── plugins
    │   │       ├── com.jrockit.mc.console.ui.notification_5.5.2.174165
    │   │       │   ├── html
    │   │       │   │   └── dcommon
    │   │       │   │       ├── css
    │   │       │   │       ├── gifs
    │   │       │   │       └── html
    │   │       │   ├── icons
    │   │       │   └── META-INF
    │   │       ├── com.jrockit.mc.rjmx_5.5.2.174165
    │   │       │   ├── icons
    │   │       │   ├── lib
    │   │       │   ├── META-INF
    │   │       │   └── schema
    │   │       ├── org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20141007-2033
    │   │       │   └── META-INF
    │   │       └── org.eclipse.ui.themes_1.0.1.v20140819-1717
    │   │           ├── css
    │   │           │   └── dark
    │   │           ├── images
    │   │           └── META-INF
    │   └── visualvm
    │       ├── etc
    │       ├── platform
    │       │   ├── config
    │       │   │   ├── ModuleAutoDeps
    │       │   │   └── Modules
    │       │   ├── core
    │       │   │   └── locale
    │       │   ├── lib
    │       │   │   └── locale
    │       │   ├── modules
    │       │   │   ├── ext
    │       │   │   │   └── locale
    │       │   │   └── locale
    │       │   └── update_tracking
    │       ├── profiler
    │       │   ├── config
    │       │   │   └── Modules
    │       │   ├── lib
    │       │   │   ├── deployed
    │       │   │   │   ├── jdk15
    │       │   │   │   │   └── linux-amd64
    │       │   │   │   └── jdk16
    │       │   │   │       └── linux-amd64
    │       │   │   └── locale
    │       │   ├── modules
    │       │   │   └── locale
    │       │   └── update_tracking
    │       └── visualvm
    │           ├── config
    │           │   └── Modules
    │           ├── core
    │           │   └── locale
    │           ├── modules
    │           │   └── locale
    │           └── update_tracking
    └── man
        ├── ja -> ja_JP.UTF-8
        ├── ja_JP.UTF-8
        │   └── man1
        └── man1

202 directories
[root@centos01 centos01]#                   

 

posted @ 2018-08-19 02:16  茗::流  阅读(388)  评论(0)    收藏  举报
如有雷同,纯属参考。如有侵犯你的版权,请联系我。