Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I display a tree of things in Bash?

How do I make a tree of all things with bash? What is the command?

like image 433
pedro Avatar asked Mar 15 '10 00:03

pedro


People also ask

How do I display a tree in Linux?

You need to use command called tree. It will list contents of directories in a tree-like format. It is a recursive directory listing program that produces a depth indented listing of files. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn.

What is tree command in bash?

The “tree” command is a very extensively used Bash command in Linux. It is used to display the contents of any desired directory of your computer system in the form of a tree structure.

What is the output of tree command?

Upon completion of listing all files and directories found, tree returns the total number of files and directories listed. There are options to change the characters used in the output, and to use color output. The command is available in MS-DOS versions 3.2 and later and IBM PC DOS releases 2 and later.


1 Answers

you should probably alias this :)

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

(Warning: huge output)

like image 144
meatspace Avatar answered Oct 27 '22 08:10

meatspace