Questions tagged [tree]

the command line tool for displaying a directory structure in a tree form

tree is a versatile tool for displaying directory structures. The default is an ASCII/Unicode-art tree:

$ tree ~/ -L 1
/home/ubuntu/
├── Desktop
├── Documents
├── Downloads
├── Music
├── Pictures
├── Public
├── Templates
└── Videos
8 directories, 0 files.

It can also do:

  • HTML output
  • Output to a given level
  • List only files matching a pattern
  • Print file information (like sizes, dates, etc.)
39 questions
70
votes
4 answers

How do I make *tree* list hidden files as well?

I'm using this package called tree to list sub directories and files in a given directory. It works fine except it doesn't list hidden files. When I run tree in a folder it returns ├── Zodiac (2007) │   └── Zodiac (2007).mkv ├── Zombieland (2009)…
55
votes
1 answer

How to install "tree" with command-line?

How do I install "tree" via apt-get in Terminal? I have been trying to do apt-get update tree but nothing seems to happen. Is it necessary to include sudo in the command?
user367253
18
votes
1 answer

How to print the output of tree to pdf without losing the color?

I use the following command to print a directory structure to a file: tree -h somepath/ > tree_of_somepath.txt tree gives a nice colorized output on the terminal, but as expected this cannot be redirected to a text file. I would like to print the…
Bruni
  • 11,099
17
votes
2 answers

Is there any command line to show tree view directory?

Many tutorials depict tree-view directory to show how they organize their files. Is there any command line to show such view? Is ls capable to do this?
betauli
  • 301
  • 1
  • 3
  • 6
12
votes
3 answers

Show n files in each directory with tree command

I have the following directory structure: bocoup_data/ ├── text_reuse │   └── v2 │   └── json │   ├── alignments │   └── texts └── topic_modelling └── v2 └── json I'd like to be able to show a subset of the files in…
duhaime
  • 638
11
votes
2 answers

Save result data command tree

I need to save all of the results of the command tree in a txt file. The objective is to save this data in a data base for later work in php and html. The main objective is to expose the structure on a web page to determine the structure of the…
10
votes
3 answers

How do I use tree to show the path to filenames containing a particular string?

I have got a rather large file system, and let's say that I want to find all the files and directories in a certain area of my file system which contain the String ActionListeener, and to do this I want to use tree. So if I do: tree ~/ | grep…
user364819
10
votes
4 answers

Tree Command not working in some directories

I was learning about virtual environments and projects. While watching videos I encountered 'tree command I installed tree and then run it. But it is not working on other partition of my HDD other than / partition. When I use tree in ~/Documents,…
7
votes
2 answers

Show tree of directory with files content

I would like to print out in terminal tree like one below: $ tree -a . └── .git ├── branches ├── config ├── description ├── HEAD ├── hooks │   ├── applypatch-msg.sample │   ├── commit-msg.sample │   ├──…
5
votes
1 answer

Print size of directory content with tree command, but exclude files from report

I often use du --max-depth=n -h | sort --human-numeric-sort Now I want to use tree, in a similar manner. I found here a partial answer tree -sh --sort=size --du where --du makes tree reporting the cumulative size for each directory (as du). This…
3
votes
1 answer

How many files do I have?

If I as root in Nautilus at the top directory open the properties I get: Name: / Type: Folder (inode/directory) Contents: 1 560 503 items, totalling 414,8 GB Trying root@nilx:/# locate * | wc I get 2997356 3450407 217324980 and root@nilx:/# tree…
user37342
  • 309
3
votes
0 answers

Explain difference in non-hidden file count when using Nautilus vs. using other tools such as tree and how to independently calculate former count?

I recently have been backing up my files from a laptop and as part of that have opted to move a folder that at first seemed to be of size 107.6 GB from one hard drive to another. As I was copying, I noticed that a dialog box showed up saying there…
bzliu94
  • 131
3
votes
1 answer

apt --fix-broken install

I am new to this. Just got this message below and I cant figure out how to fix it Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The…
2
votes
0 answers

How to list contents of compressed files in a hierarchy mode?

Consider we have a file named XX.zip Use command zipinfo -1 XX.zip which shows the below content: XX/ XX/X-Data.txt XX/YY/ XX/YY/Zero.txt I wanna below output instead, assume we have extracted the zip file unzip XX.zip and then use command tree XX…
mipa
  • 21
2
votes
1 answer

why is output different of counting files?

I just want to count all the files in a directory. I used two method what I found: tree /home/bkp Whit this method the output is 2177879 file. find /home/bkp -type f | wc -l And with that one is 2176704 file What makes the difference? How I…
1
2 3