Linux command to print directory structure in the form of a tree [closed]

Is there any linux command that will print the directory structure in the form of a tree, e.g.,

folder1
   a.txt
   b.txt
folder2
   folder3

print directory tree

I have to print a directory tree (like tree command), example: . +—A | +—IMAGES | +—BACKUP +—ADOKS | +—ROZDZIAL_2 | +—ROZDZIAL_3 | +—ROZDZIAL_4 +—AMSC2005 | +—AMSC2004 +—FCCS2005

How to print the directory tree?

Is there a way to print the directory tree with all files contained ?

Core Data Directory (tree) Structure

There are a lot of topics on core data tree structures but I’m left with some questions. What I’m trying to create is a simple directory structure. (Folders with subfolders with subfolders, … and la

Print a “tree” structure in JSP page

I’m trying to print out a tree structure in my JSP page that looks something like this: Root | |—-Dependencies | |—-A | |—-B | |—-C | |—-Dependents |—-D |—-E I’m hoping that someone a

Linux zip doesn’t maintain directory structure

I have a directory I am trying to zip on Linux before sending it to Windows. I thought it worked with this command: zip -r directory.zip directory However when I looked at the directory it contained

Building an out-of-tree Linux kernel module in a separate object directory

I’m confronting the Linux kernel build system (Kbuild, kernel ≥2.6.28) with the directory structure and build system for a larger project. Our project contains an out-of-tree Linux kernel module, and

lxml (or lxml.html): print tree structure

I’d like to print out the tree structure of an etree (formed from an html document) in a differentiable way (means that two etrees should print out differently). What I mean by structure is the shape

CentOS directory structure as tree?

Is there an equivalent to tree on CentOS?

Print out the whole directory tree

The code i have now: import os Tree = {} Tree = os.listdir(‘Dir’) >>>print(Tree) [‘New Folder’, ‘Textfile1.txt’, ‘Textfile2.txt’] That doesn’t print out the files in the subdirectories.

Development directory Structure [closed]

I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc. I recently used a Maven structure for a java p

Answers

You can use this one:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^//]*///--/g' -e 's/^/   /' -e 's/-/|/'

It shows a graphical representation of the current sub-directories. Source here

is this what your looking for tree, should be in most distributions (maybe as an optional install)?

~> tree -d /proc/self/
/proc/self/
|-- attr
|-- cwd -> /proc
|-- fd
|   `-- 3 -> /proc/15589/fd
|-- fdinfo
|-- net
|   |-- dev_snmp6
|   |-- netfilter
|   |-- rpc
|   |   |-- auth.rpcsec.context
|   |   |-- auth.rpcsec.init
|   |   |-- auth.unix.gid
|   |   |-- auth.unix.ip
|   |   |-- nfs4.idtoname
|   |   |-- nfs4.nametoid
|   |   |-- nfsd.export
|   |   `-- nfsd.fh
|   `-- stat
|-- root -> /
`-- task
    `-- 15589
        |-- attr
        |-- cwd -> /proc
        |-- fd
        | `-- 3 -> /proc/15589/task/15589/fd
        |-- fdinfo
        `-- root -> /

27 directories

sample taken from maintainers web page.

To add Hassou’s solution to your .bashrc, try:

alias lst='ls -R | grep ":$" | sed -e '"'"'s/:$//'"'"' -e 
          '"'"'s/[^-][^//]*///--/g'"'"' -e '"'"'s/^/   /'"'"' -e '"'"'s/-/|/'"'"