Linux - Show directory structure and all files in text format

By xngo on July 10, 2019

  1. Run the following to install.
    aptitude -y install tree
     
  2. Here is an example of what it will show for /root/.java directory:
    # tree /root/.java/
    /root/.java/
    `-- deployment
        |-- cache
        |   |-- javapi
        |   |   `-- v1.0
        |   |       |-- ext
        |   |       |-- file
        |   |       |   |-- ADT_homepage4.gif-1731c063-7adea2e8.idx
        |   |       |   |-- LiveCounter.class-10be6239-7b0308a3.class
        |   |       |   |-- LiveCounter.class-10be6239-7b0308a3.idx
        |   |       |   |-- RotatingPicture.class-b6f03b0-1332bc45.class
        |   |       |   |-- map1.gif-5bd14354-33c04e0a.gif
        |   |       |   |-- site0.gif-15518bd4-551cfce3.gif
        |   |       |   |-- site0.gif-15518bd4-551cfce3.idx
        |   |       |   |-- theCicero.class-474ef599-29a40ad6.class
        |   |       |   |-- theCicero.class-474ef599-29a40ad6.idx
        |   |       |   |-- up.gif-495c0cfe-369c9ad6.gif
        |   |       |   |-- up.gif-495c0cfe-369c9ad6.idx
        |   |       |   |-- util2.gif-7ab0e6fb-10bad922.gif
        |   |       |   `-- util2.gif-7ab0e6fb-10bad922.idx
        |   |       |-- jar
        |   |       |   |-- Ticker.jar-5dfbca87-51bf510b.hst
        |   |       |   |-- Ticker.jar-5dfbca87-51bf510b.idx
        |   |       |   |-- txtscroll.jar-64d28141-7ae6c7fe.idx
        |   |       |   `-- txtscroll.jar-64d28141-7ae6c7fe.zip
        |   |       `-- tmp
        |   `-- tmp
        |-- deployment.properties
        |-- ext
        |-- host
        |   |-- 167dc6a3.hst
        |   |-- 7ff51e9b.hst
        |   `-- b145321.hst
        |-- log
        |   `-- plugin150_14.trace
        `-- security
     

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.