⑤linux基础命令 tree

以树状的结构显示目录和文件
[root@rstx-201 ~]# tree
.
├── anaconda-ks.cfg
├── test
└── test2
    ├── 1
    └── 2
4 directories, 1 file  #显示文件和目录的数量
tail -L 查看目录层数
[root@rstx-53 ~]# tree -L 1
.
├── anaconda-ks.cfg
├── c2p.zip
├── Californium.properties
├── cfssljson_linux-amd64

[root@rstx-53 ~]# tree -L 2
.
├── anaconda-ks.cfg
├── c2p.zip
├── Californium.properties
├── cfssljson_linux-amd64
├── httpd
│   ├── Dockerfile
│   ├── index.html
│   ├── nginx-1.19.3.tar.gz
│   └── yum.repos.d
├── jenkins
│   ├── config.xml
tail -d 只查看目录
[root@rstx-53 ~]# tree -L 2 -d
.
├── httpd
│   └── yum.repos.d
├── jenkins
│   ├── jobs
│   ├── logs
│   ├── nodes
│   ├── plugins
│   ├── secrets
│   ├── updates
│   ├── userContent
│   ├── users
│   └── war
tail -f 只查看文件
[root@rstx-53 ~]# tree -L 2 -f
.
├── ./anaconda-ks.cfg
├── ./c2p.zip
├── ./Californium.properties
├── ./cfssljson_linux-amd64
├── ./httpd
│   ├── ./httpd/Dockerfile
│   ├── ./httpd/index.html
│   ├── ./httpd/nginx-1.19.3.tar.gz
│   └── ./httpd/yum.repos.d
├── ./jenkins
│   ├── ./jenkins/config.xml
│   ├── ./jenkins/copy_reference_file.log
│   ├── ./jenkins/hudson.model.UpdateCenter.xml
│   ├── ./jenkins/identity.key.enc
│   ├── ./jenkins/jenkins.install.UpgradeWizard.state
│   ├── ./jenkins/jenkins.telemetry.Correlator.xml
│   ├── ./jenkins/jobs
原文地址:https://www.cnblogs.com/yangtao416/p/14451757.html