Questions tagged [tree]
111 questions
157
votes
2 answers
How do we specify multiple ignore patterns for `tree` command?
I need to print the directory structure of our production system and I would like to remove some specific directories from the tree?
How do we specify multiple ignore patterns for tree command?
Bharat Sinha
- 1,713
- 2
- 12
- 8
92
votes
3 answers
Print size of directory content with tree command in tree 1.5?
I like tree it's a nice way to display my files and the size of folders/directories. But the -h option only shows the size of the directory, not the cumulative size of its contents.
/media/
├── [ 16K] 64D9-E862
│ ├── [8.0K] downloads
I know for…
AncientSwordRage
- 1,714
- 1
- 20
- 26
67
votes
3 answers
"tree" command output with "pure" (7-bit) ASCII output
The "tree" command uses nice box-drawing characters to show the tree but I want to use the output in a "code-page-neutral" context (I know that really there's always a code page, but by restricting it to the lower characters I hope to be free of…
Tom Goodfellow
- 867
- 1
- 6
- 7
54
votes
2 answers
cat files in current folder and all subfolders
I want to cat a file in current folder and all files in all subfolders (and subsubfolders).
Here is my directory structure
$ tree
.
├── f
│ └── foo
└── yo
I want to cat foo and yo.
I've tried this command but did not work:
cat */*
It just cats…
Mohsen
- 2,495
- 4
- 25
- 29
53
votes
4 answers
tree command for multiple includes and excludes
Could you please give me an example of using the tree command to filter out result as follows:
to ignore directories (say bin, unitTest)
only listing certain files having extensions (say .cpp, .c, .hpp, .h)
providing full path-names of only the…
Linda
- 531
- 1
- 4
- 4
32
votes
5 answers
combine the best of 'du' and 'tree'
I'm wondering if we can combine the honesty of 'du' with the indented formatting of 'tree'. If I want a listing of the sizes of directories:
du -hx -d2
...displays two levels deep and all the size summaries are honest, but there's no indenting of…
Ray Andrews
- 2,125
- 4
- 20
- 37
31
votes
6 answers
Have tree hide gitignored files
Is there a way to make tree not show files that are ignored in .gitignore?
Brad Urani
- 413
- 4
- 6
17
votes
2 answers
How can I pipe colored tree result to less or more?
I get colored tree using tree -C but when I pipe it to less I get results like this:
tree public/ -C | less
How can I have colors in less in this case?
Mohsen
- 2,495
- 4
- 25
- 29
14
votes
5 answers
Convert output of tree command to json format
Is there a convenient way to convert the output of the *nix command tree to JSON format? My goal is to convert something like:
.
|-- dir1
| |-- dirA
| | |-- dirAA
| | `-- dirBB
| `-- dirB
`-- dir2
|-- dirA
`-- dirB
into:
{"dir1"…
roundrobin
- 243
- 1
- 2
- 6
14
votes
4 answers
How to make tree output only files?
tree has a -d option to "List directories only.". However, I cannot seem to find an option to "List files only." I have looked through the man page, but I cannot seem to find an option for listing only files.
stiemannkj1
- 293
- 1
- 2
- 9
13
votes
4 answers
Is there a way to disable wget from getting files from parent directories to given depth?
wget has such option as -np which disables getting files from any parent directory. I need something similar but a bit more flexible. Consider:
www.foo.com/bar1/bar2/bar3/index.html
I would like to get everything but not "higher" (in the tree…
greenoldman
- 6,086
- 16
- 54
- 65
11
votes
1 answer
How to display btrfs subvolume tree?
Is there a way to make a btrfs subvolume tree like what is shown below? (Only subvolumes - no regular directories or files.)
# tree /mnt/1
/mnt/1
├── a
├── snapshot
│ ├── a
│ └── subv
└── subv
└── b
This example is created from a "sample"…
user1902689
- 1,178
- 3
- 12
- 23
8
votes
1 answer
Interactive tree command
Is there any version of tree command that displays file structure as a tree structure, but in a way that I can interactively walk trough?
Why do I need it exactly - I am trying to simulate TextMate project drawer using vim and splitscreen with…
Karel Bílek
- 1,859
- 5
- 20
- 26
7
votes
4 answers
Print indentations with whitespace only in tree command
I want to list the subdirectories of a directory using tree command. But I don't want to print indentation lines. I only want to have the whitespaces instead.
I couldn't find the correct parameter in man page. Maybe I can pipe the output of tree to…
Mert Nuhoglu
- 661
- 2
- 7
- 11
7
votes
1 answer
Automatically colorize the output of tree
In plain zsh, tree is set similar to --color=auto by default. However, when I use Oh-My-Zsh, tree doesn't show colors. Since tree does not have a --color=auto option, how can I override the setting back to the auto one?
Franklin Yu
- 1,227
- 12
- 23