Tree

Tree is a simple and unique utility. It sticks to the Unix motto of doing one thing and doing it well. As stated in the info page, it list contents of directories in a tree-like format

If you're a visual kind of person, this utility is very useful at times. I use it when I have to replicate applications, or mirror the structure of a directory somewhere else.

You can specify the how deep tree will go when you call it. Here are two examples. one with 2 levels and one with 5 levels. All done from the tftboot directory on my kickstart box.

[root@netboot-system-og tftpboot]# tree -L 2
.
|-- images
|   |-- centos
|   |-- live
|   |-- oralce
|   |-- ubuntu
|   `-- windows
|-- menu.c32
|-- pxelinux.0
`-- pxelinux.cfg
    |-- default
    |-- default.bak
    |-- default.ubuntu.904.64
    `-- default.working.applianceks

7 directories, 6 files

[root@netboot-system-og tftpboot]# tree -L 5
.
|-- images
|   |-- centos
|   |   |-- x86
|   |   |   `-- 4.4
|   |   |       |-- initrd.3ware.img
|   |   |       |-- initrd.base.img
|   |   |       |-- initrd.img
|   |   |       |-- initrd.img.b4-og-add-8168-drv
|   |   |       |-- initrd.orig
|   |   |       |-- initrd.r8168.img
|   |   |       |-- initrd.r8169.img
|   |   |       `-- vmlinuz
|   |   `-- x86_64
|   |       |-- 5.2
|   |       |   |-- initrd.img
|   |       |   `-- vmlinuz
|   |       `-- 5.3
|   |           |-- initrd.img
|   |           `-- vmlinuz
|   |-- live
|   |   `-- clonezilla
|   |       `-- 1.2.1-53
|   |           |-- filesystem.squashfs
|   |           |-- initrd1.img
|   |           `-- vmlinuz1
|   |-- oralce
|   |   `-- vmserver
|   |       `-- 2.1.2
|   |           |-- initrd.img
|   |           |-- initrd.img.old
|   |           |-- vmlinuz
|   |           `-- vmlinuz.old
|   |-- ubuntu
|   |   `-- x86_64
|   |       `-- 904
|   |           |-- boot-screens
|   |           |-- initrd.gz
|   |           |-- linux
|   |           |-- pxelinux.0 -> ubuntu-installer/amd64/pxelinux.0
|   |           |-- pxelinux.cfg -> ubuntu-installer/amd64/pxelinux.cfg
|   |           |-- ubuntu-installer
|   |           `-- version.info
|   `-- windows
|       `-- 2003
|           `-- std
|               |-- NTDETECT.COM
|               |-- W2K3L
|               `-- w2k3.0
|-- menu.c32
|-- pxelinux.0
`-- pxelinux.cfg
    |-- default
    |-- default.bak
    |-- default.ubuntu.904.64
    `-- default.working.applianceks

23 directories, 32 files

You can see that it is easy to "view" the contents of the directories and get an idea of the structure at a glance.

Similar Posts