命令——tree


tree——以树形结构显示目录文件

[root@centos71 ~]# yum  provides  tree 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
tree-1.6.0-10.el7.x86_64 : File system tree viewer
Repo        : @base
[root@centos71 ~]# tree   /etc/sysconfig/
/etc/sysconfig/
├── anaconda
├── authconfig
├── cbq
│   ├── avpkt
│   └── cbq-0000.example
├── chronyd
├── console
├── cpupower
├── crond
├── ebtables-config
├── firewalld
├── grub -> ../default/grub
├── init
├── ip6tables-config ├── iptables-config ├── irqbalance ├── kdump ├── kernel ├── man-db ├── modules ├── netconsole ├── network ├── network-scripts │   ├── ifcfg-eth0 │   ├── ifcfg-lo │   ├── ifdown -> ../../../usr/sbin/ifdown │   ├── ifdown-bnep │   ├── ifdown-eth │   ├── ifdown-ippp │   ├── ifdown-ipv6 │   ├── ifdown-isdn -> ifdown-ippp │   ├── ifdown-post │   ├── ifdown-ppp │   ├── ifdown-routes │   ├── ifdown-sit │   ├── ifdown-Team │   ├── ifdown-TeamPort │   ├── ifdown-tunnel │   ├── ifup -> ../../../usr/sbin/ifup │   ├── ifup-aliases │   ├── ifup-bnep │   ├── ifup-eth │   ├── ifup-ippp │   ├── ifup-ipv6 │   ├── ifup-isdn -> ifup-ippp │   ├── ifup-plip │   ├── ifup-plusb │   ├── ifup-post │   ├── ifup-ppp │   ├── ifup-routes │   ├── ifup-sit │   ├── ifup-Team │   ├── ifup-TeamPort │   ├── ifup-tunnel │   ├── ifup-wireless │   ├── init.ipv6-global │   ├── network-functions │   └── network-functions-ipv6 ├── ntpdate ├── rdisc ├── readonly-root ├── rsyncd ├── rsyslog ├── run-parts ├── selinux -> ../selinux/config ├── sshd ├── svnserve ├── trace-cmd.conf └── wpa_supplicant 4 directories, 65 files

只查看完整目录结构信息,因为有时候不能确定是文件还是目录

[root@centos71 ~]# tree  -d   /etc/sysconfig/
/etc/sysconfig/
├── cbq
├── console
├── modules
└── network-scripts

4 directories

指定查看目录层级信息

[root@centos71 ~]# tree   -L  1     /etc/sysconfig/  
/etc/sysconfig/
├── anaconda
├── authconfig
├── cbq
├── chronyd
├── console
├── cpupower
├── crond
├── ebtables-config
├── firewalld
├── grub -> ../default/grub
├── init
├── ip6tables-config
├── iptables-config ├── irqbalance ├── kdump ├── kernel ├── man-db ├── modules ├── netconsole ├── network ├── network-scripts ├── ntpdate ├── rdisc ├── readonly-root ├── rsyncd ├── rsyslog ├── run-parts ├── selinux -> ../selinux/config ├── sshd ├── svnserve ├── trace-cmd.conf └── wpa_supplicant 4 directories, 28 files

猜你喜欢

转载自www.cnblogs.com/wang618/p/12056887.html