In Linux, the tree command is used to print the specified N-level directory structure or file.

Source: Internet
Author: User
Tags aliases gnupg iptables

Ee view, especially when there are many small files, the headers displayed are all big. We need to view the specified level.
The default tree command is not installed. You need to install yum or apt-get separately. For more information about tree parameters, see tree-help. Below are some common parameters:
-C: color of the tree for easy display.
-D: displays only directories.
-L: displays the number of levels and key parameters.

For example, we can view the layer-3 files and directories under/etc:

[Root @ drlb etc] # tree-L 3
.
── Adjtime
── Aliases
── Aliases. db
── Alternatives
│ ── Bin-iptables-xml.x86_64-& gt;/bin/iptables-xml-1.4.7
│ ├ ── Ip6tables. x86_64-& gt;/sbin/ip6tables-1.4.7
│ ├ ── Iptables. x86_64-& gt;/sbin/iptables-1.4.7
│ ── Libip4tc000. x86_64-& gt;/lib64/libip4tc. so.0.0.0-1.4.7
│ ── Libip4tc0. x86_64-& gt;/lib64/libip4tc. so.0-1.4.7
│ ── Libip6tc000. x86_64-& gt;/lib64/libip6tc. so.0.0.0-1.4.7
│ ── Libip6tc0. x86_64-& gt;/lib64/libip6tc. so.0-1.4.7
│ ── Libipq000.x86 _ 64-& gt;/lib64/libipq. so.0.0.0-1.4.7
│ ── Libipq0.x86 _ 64-& gt;/lib64/libipq. so.0-1.4.7
│ ── Libiptc000.x86 _ 64-& gt;/lib64/libiptc. so.0.0.0-1.4.7
│ ── Libiptc0.x86 _ 64-& gt;/lib64/libiptc. so.0-1.4.7
│ ── Libnssckbi. so. x86_64-& gt;/usr/lib64/nss/libnssckbi. so
│ ── Libxtables400.x86 _ 64-& gt;/lib64/libxtables. so.4.0.0-1.4.7
│ ── Libxtables4.x86 _ 64-& gt;/lib64/libxtables. so.4-1.4.7
│ ├ ── Man-ip6tables-restore.x86_64-& gt;/usr/share/man/man8/ip6tables-restore-1.4.7.8.gz
│ ├ ── Man-ip6tables-save.x86_64-& gt;/usr/share/man/man8/ip6tables-save-1.4.7.8.gz
│ ├ ── Man-ip6tables.x86_64-& gt;/usr/share/man/man8/ip6tables-1.4.7.8.gz
│ ├ ── Man-iptables-restore.x86_64-& gt;/usr/share/man/man8/iptables-restore-1.4.7.8.gz
│ ├ ── Man-iptables-save.x86_64-& gt;/usr/share/man/man8/iptables-save-1.4.7.8.gz
│ ├ ── Man-iptables.x86_64-& gt;/usr/share/man/man8/iptables-1.4.7.8.gz
│ ├ ── Man-iptables-xml.x86_64-& gt;/usr/share/man/man8/iptables-xml-1.4.7.8.gz
│ ├ ── Mta-& gt;/usr/sbin/sendmail. postfix
│ ├ ── Mta-aliasesman-& gt;/usr/share/man/man5/aliases.postfix.5.gz
│ ├ ── Mta-mailq-& gt;/usr/bin/mailq. postfix
│ ├ ── Mta-mailqman-& gt;/usr/share/man/man1/mailq.postfix.1.gz
│ ├ ── Mta-newaliases-& gt;/usr/bin/newaliases. postfix
│ ├ ── Mta-newaliasesman-& gt;/usr/share/man/man1/newaliases.postfix.1.gz
│ ├ ── Mta-pam-& gt;/etc/pam. d/smtp. postfix
│ ├ ── Mta-rmail-& gt;/usr/bin/rmail. postfix
│ ├ ── Mta-sendmail-& gt;/usr/lib/sendmail. postfix
│ ├ ── Mta-sendmailman-& gt;/usr/share/man/man1/sendmail.postfix.1.gz
│ ├ ── Sbin-ip6tables-multi.x86_64-& gt;/sbin/ip6tables-multi-1.4.7
│ ├ ── Sbin-ip6tables-restore.x86_64-& gt;/sbin/ip6tables-restore-1.4.7
│ ├ ── Sbin-ip6tables-save.x86_64-& gt;/sbin/ip6tables-save-1.4.7
│ ├ ── Sbin-iptables-multi.x86_64-& gt;/sbin/iptables-multi-1.4.7
│ ├ ── Sbin-iptables-restore.x86_64-& gt;/sbin/iptables-restore-1.4.7
│ └ ── Sbin-iptables-save.x86_64-& gt;/sbin/iptables-save-1.4.7
── Anacrontab
├ ── Audisp
│ ── Audispd. conf
│ ── Plugins. d
│ ── Af_unix.conf
│ ── Syslog. conf
├ ── Audit
│ ── Auditd. conf
│ └ ── Audit. rules
── Bash_completion.d
│ ── Gdbus-bash-completion.sh.
│ ── Gsettings-bash-completion.sh.
│ ── Salt. bash
│ ── Yum. bash
│ ── Yum-utils.bash.
├ ── Bashrc
── Blkid
│ ── Blkid. tab
├ ── Centos-release
── Chkconfig. d
── Cron. d
│ ── 0 hourly
│ ── Raid-check
│ ── Vnstat
── Cron. daily
│ ── Logrotate
── Cron. deny
── Cron. hourly
│ ── 0 anacron
── Cron. monthly
── Crontab
── Cron. weekly
├ ── Crypttab
├ ── Csh. cshrc
── Csh. login
── Dbus-1
│ ── System. d
│ ── Upstart. conf
── Default
│ ── Nss
│ ── Useradd
── Depmod. d
│ ── Dist. conf
── Dhcp
│ ── Dhclient. d
── DIR_COLORS
── DIR_COLORS.256color
── DIR_COLORS.lightbgcolor
── Dracut. conf
── Dracut. conf. d
── Environment
── Ethers
── Exports
── Favicon.png-& gt;/usr/share/icons/hicolor/16x16/apps/system-logo-icon.png
── Filesystems
── Fonts
│ ── Conf. avail
│ ── 10-10-autohint.conf
│ ── 10-no-sub-pixel.conf
│ ── 10-10-sub-pixel-bgr.conf
│ ── 10-10-sub-pixel-rgb.conf
│ ── 10-10-sub-pixel-vbgr.conf
│ ── 10-10-sub-pixel-vrgb.conf
│ ── 10-10-unhinted.conf
│ ── 20-fix-globaladvance.conf
│ ── 20-unhint-small-vera.conf
│ ── 25-unhint-nonlatin.conf
│ ── 30-metric-aliases.conf
│ ── 30-urw-aliases.conf
│ ── 40-nonlatin.conf
│ ── 45-latin.conf
│ ── 49-sansserif.conf
│ ── 50-user.conf
│ ── 51-local.conf
│ ── 60-60-latin.conf
│ ── 65-fonts-persian.conf
│ ── 65-khmer.conf
│ ── 65-nonlatin.conf
│ ── 69-uniont.conf
│ ── 70-no-bitmaps.conf
│ ── 70-yes-bitmaps.conf
│ ── 80-delicious.conf
│ ── 90-synthetic.conf
│ ── Conf. d
│ ── 20-fix-globaladvance.conf-& gt;.../conf. avail/20-fix-globaladvance.conf
│ ── 20-unhint-small-vera.conf-& gt;.../conf. avail/20-unhint-small-vera.conf
│ ── 25-no-bitmap-dist.conf
│ ── 25-unhint-nonlatin.conf-& gt;.../conf. avail/25-unhint-nonlatin.conf
│ ── 30-metric-aliases.conf-& gt;.../conf. avail/30-metric-aliases.conf
│ ── 30-urw-aliases.conf-& gt; ../conf. avail/30-urw-aliases.conf
│ ── 40-nonlatin.conf-& gt;.../conf. avail/40-nonlatin.conf
│ ── 45-latin.conf-& gt;.../conf. avail/45-latin.conf
│ ── 49-sansserif.conf-& gt; ../conf. avail/49-sansserif.conf
│ ── 50-user.conf-& gt; ../conf. avail/50-user.conf
│ ── 51-local.conf-& gt; ../conf. avail/51-local.conf
│ ── 60-60-latin.conf-& gt; ../conf. avail/60-latin.conf
│ ── 65-fonts-persian.conf-& gt;.../conf. avail/65-fonts-persian.conf
│ ── 65-nonlatin.conf-& gt;.../conf. avail/65-nonlatin.conf
│ ── 69-uniont.conf-& gt;.../conf. avail/69-uniont.conf
│ ── 80-delicious.conf-& gt; ../conf. avail/80-delicious.conf
│ ── 90-synthetic.conf-& gt;.../conf. avail/90-synthetic.conf
│ ── README
│ ── Fonts. conf
│ ── Fonts. dtd
── Fstab
├ ── Gai. conf
├ ── Gcrypt
── Gnupg
── Group
── Group-
── Grub. conf-& gt; ../boot/grub. conf
── Gshadow
── Gshadow-
── Host. conf
── Hosts
── Hosts. allow
── Hosts. deny
── Init
│ ── Control-alt-delete.conf.
│ ── Init-system-dbus.conf.
│ ── Kexec-disable.conf.
│ ── Plymouth-shutdown.conf.
│ ├ ── Preofdm. conf
│ ── Quit-plymouth.conf.
│ ── Rc. conf
│ ── RcS. conf
│ ── RcS-emergency.conf.
│ ── RcS-sulogin.conf.
│ ── Serial. conf
│ ── Splash-manager.conf.
│ ── Start-ttys.conf.
│ ── Tty. conf
── Init. d-& gt; rc. d/init. d
── Inittab
── Inputrc
── Iproute2
│ ── Ematch_map
│ ── Rt_dsfield
│ ── Rt_protos
│ ── Rt_realms
│ ── Rt_scopes
│ ── Rt_tables
── Iscsi
│ ── Initiatorname. iscsi
│ ── Iscsid. conf
── Issue
── Issue.net
── Keepalived
│ ── Keepalived. conf
── Krb5.conf
 
If only the directory is displayed, we can use tree-d-L 3.

[Root @ drlb etc] # tree-d-L 3
.
── Alternatives
├ ── Audisp
│ ── Plugins. d
├ ── Audit
── Bash_completion.d
── Blkid
── Chkconfig. d
── Cron. d
── Cron. daily
── Cron. hourly
── Cron. monthly
── Cron. weekly
── Dbus-1
│ ── System. d
── Default
── Depmod. d
── Dhcp
│ ── Dhclient. d
── Dracut. conf. d
── Fonts
│ ── Conf. avail
│ ── Conf. d
├ ── Gcrypt
── Gnupg
── Init
── Init. d-& gt; rc. d/init. d
── Iproute2
── Iscsi
── Keepalived
 
If you add a color display, you can add the-C parameter for more intuitive viewing.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.