Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [tree]

The tag has no usage guidance.

0
votes
1answer
32 views

Using tree with tar.gz file without extracting contents

I am wondering if it's possible to output the contents of a tar.gz file using tree without having to extract the contents of the file to a temp directory then using tree with that directory. I know ...
1
vote
2answers
75 views

How to convert `iptables -S` output to a breadth-first listing

I'm looking for a program that takes the output of iptables -S and converts it to a breadth-first listing. Why? I'm doing some work on a router using VyOS where several layers of tables are pre-...
3
votes
1answer
57 views

Command “tree” vs “tree -R”

So I'm asking myself why there is the "-R" argument for the "tree" command. The manual says "-R Recursively cross down the tree each level directories ...", but I don't see any difference in the ...
2
votes
1answer
94 views

pipe of tar and tree commands?

I would like to see the tree of a big compressed file (specifically only the second level of directories) so I used the following command: tar -tf tarfile | tree -L 2 But it outputs the tree of the ...
3
votes
1answer
412 views

Why can't tree fully list /sys/class/hwmon? And how could I do that?

If I understand correctly, in Linux, everything is a path, right down to each piece of hardware. I am trying to get information about how my sensors are structured, so I thought I would just use tree ...
0
votes
0answers
15 views

Ambiguous output from tree with respect to symbolic links

Whenever I use command line tools, I like to make sure that the output can be interpreted unambiguously. On one of my other machines, I wrote a shell script that would find all of the symbolic links ...
2
votes
1answer
45 views

tree(1) colours not properly interpeted by watch(1) even with --color option

I am using a simple combination of commands to "monitor" a bit of my filesystem change: watch and tree. Except I want colours and can't get it. Here's what I thought should work: watch --color 'tree -...
0
votes
2answers
43 views

Directory tree listing, script does not work in csh?

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' I found a command to display directory tree (see above), it didn't work correctly. It gave error message "...
1
vote
1answer
2k views

Tree command package installation?

I tried to use the tree command in a bootable USB Ubuntu environment but it showed that it is not installed so I tried sudo apt install tree, but it didn't work and reported that it was unable to ...
5
votes
3answers
1k views

Linux Filesystem Tree

Is there a pictorial representation of Linux filesystem, to understand the Linux filesystem. Currently running Ubuntu 16.04 and I want to efficiently re-install, using 2 HDD, 1x250GB and 1x500GB. ...
0
votes
1answer
44 views

How to enable automatically colorize the output of tree without using -C flag in bash all the time?

I am tired of using the -C with the tree all the time. I would like to tweak the tree to colorize files and directories to its automatic behavior so that I don't have to type the -C flag all the time. ...
1
vote
2answers
48 views

Replace fenced block with output of command in bash

I'm attempting to replace a "fenced" block of text with the output from the tree command in linux (specifically in a make file). Here's my input file: some text... [fencetitle] ---- . ├── file1.txt └...
1
vote
1answer
66 views

Make a visually better looking tree [closed]

I am trying to visually show the tree structure of a directory. I know about the tree command and that works for me, but is there a program that takes the tree command output and makes it a bit more ...
2
votes
0answers
46 views

Exclude sub-directories from tree output [duplicate]

I would like to document a directory structure, and installed tree to do so. I don't wish to include files but only directories and symbolic links which point to directories (haven't decided if the ...
1
vote
1answer
39 views

Copying a tree with modes

Suppose my build script creates something like: build ├── [drwxr-xr-x pskocik pskocik ] bin │   └── [-rwxr-xr-x pskocik pskocik ] FOO_bin ├── [drwxr-xr-x pskocik pskocik ] include │   ├── [...
0
votes
1answer
92 views

Create 'tree' output from list of files

I have a large list of directories and filenames in the format drwxr-sr-x hamiltont/hamiltont 0 2015-03-11 23:54 Archive/Directory One/Subdir/ -rw-r--r-- hamiltont/hamiltont 21799 2014-01-10 12:52 ...
3
votes
2answers
1k views

How to combine tree with the directory size?

I am trying to print the space occupied by directories (two levels down). The size listed is not accurate. For instance large_child_folder is 150 GB. How do I get the real directory size? tree -L 2 -...
0
votes
1answer
249 views

Why does 'tree' command ignore directories but not files

tree shows ... │   ├── template_one_file.sh │   ├── template_sed.sh │   ├── testy.sh │   ├── tmp │   │   ├── file1.html.13567_old │   │   ├── file2.html.13567_old │   │   ├── file3.html.13567_old │   ...
0
votes
1answer
81 views

Getting tree to only list files matching a pattern and the directories they are contained in

Is there anyway to get tree to behave such that, when it is run with the -P option, it will not output directories that don't have files matching the pattern somewhere inside of them? As an example, ...
-2
votes
1answer
89 views

What's the difference between the `tree -L 1 /` with `tree -L 1`?

In Linux I use the tree command to show the directory construction. If I use tree -L 1 / in root directory: [root@localhost /]# tree -L 1 / / ├── a.out ├── bin -> usr/bin ├── boot ├── dev ├── etc ...
0
votes
2answers
59 views

Statistics for project filestypes [closed]

I learnt that there was a command cloc to count lines of code. Now I wonder if it the file types are accurate? Should I look a the cloc project to know how file types are detected? The reason I wonder ...
0
votes
1answer
542 views

linux/unix tree diagram

I have a picture of a tree diagram for linux/unix terminal. Just to verify the color scheme, all the blue labels must be folders, the greens are executable, but what are the black ones? Right under ...
3
votes
1answer
605 views

List directory hierarchy with files before subdirectories

I've been trying to sort output with either tree or find, and end up getting about the same results each time of drilling down to deeper directories before files higher up in the tree. What I'm trying ...
1
vote
1answer
53 views

How can i find biggest folders in tree (fastest way)

I'm writing something for backup. And I'm working with really Big files/folders (1 million++, 100TB++) For improve my speed, at least I need to pick 10 biggest folders in tree and for that, I need to ...
3
votes
1answer
239 views

How exactly are files located under the hood? [closed]

As far as I know, once an inode of a file is found, finding the data is trivial - done by accessing a specific location on the disk, which is stored in the inode. The question however is how exactly ...
1
vote
1answer
103 views

Tree operations (find) using indices (inode numbers) to address files/directories

(removed OS mention, since I need 'general Unix/Linux' solution) Task: perform operation over files/directories, in "find way", but assuming that file/directory pathnames can change in process. ...
-2
votes
1answer
34 views

Removing Folders from Linux Tree View?

Question: Is there a way to remove the display of certain folders from the linux tree command? In my case, I'd like to be able to run something like $ tree . --remove-dir=pictures which will remove ...
0
votes
1answer
315 views

How to sort from smallest to biggest with `tree` command line tool?

Which option should be used with tree command line tool to get sort from biggest to smallest? ├── [4.0K] types2 │   └── [ 116] types2.go ├── [4.0K] types3 │   ├── [ 689] types3.go │   └── [ 0] ...
-2
votes
1answer
4k views

Is “tree” command not available for Kali Linux?

I tried to execute "tree" under Kali Linux, but it tells me command not found. I thought "tree" was a standard command for all Linux OS, do I need to install it or is there a substitute for Kali ...
0
votes
1answer
616 views

How to filter files/directories according to permission and owner(tree command)

I use tree command to get files and directories under the /usr path, tree -pgufi /usr Does it have a way to filter files/directories under this path according to several conditions(1 and 2 and 3)? ...
13
votes
2answers
1k views

Have tree hide gitignored files

Is there a way to make tree not show files that are ignored in .gitignore?
2
votes
1answer
114 views

'cd' complexity on ext4

In order to store attachments, a /path/to/atts/ directory will have numerous child-directories (product IDs) created (from 1 to ~10,000 or maybe more in the future), and in each of this subdir, 1 to ~...
2
votes
1answer
381 views

System is no longer outputting UTF-8 characters

I just had an issue with my server where it responded incredibly slowly, so I forced it to reboot over SSH. When I connected back, I found out my system no longer outputs certain characters correctly. ...
0
votes
1answer
85 views

Tree/Find command on symlinks

I have a folder with symlinks which are pointing to other folders, how can i recursively look into those folders? I would like to do a grep on those results to search for matches. doing tree will ...
3
votes
1answer
471 views

tree command in a shell script doesn't append slashes for directories

I have a shell script executes tree command $ cat _tree.sh #!/bin/sh tree -L 2 --charset ascii -I "_tree.sh|LICENSE|README.md|node_modules|nbproject" $ sh _tree.sh . |-- bower.json |-- dpl |-- dst |...
0
votes
1answer
4k views

Process tree using fork() [closed]

I am given the task of creating this process tree in C using fork, if and else: |_____1___ |___2__ | |_4_ | |_3_ | | | | | Or as a pstree like drawing: p(0)─┬─p(1)───p(3) ├─p(2) ...
1
vote
2answers
92 views

How to exclude the files with all the 4-digit numbers without the first five numbers by wild card in tree command

I want to exclude list the following number 0005 0006 ... 9998 9999 I try the following code, but failed And I use tree -I '*.[0-9][0-9][0-9][5-9]' But It creates line with 0014 0024... I ...
2
votes
1answer
4k views

How do I install TREE when the command line doesn't work?

I tried to install TREE via the sudo apt-get install tree command but nothing but an error happens ("sudo: apt-get: command not found"). How do I fix this?
3
votes
2answers
527 views

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 ...
0
votes
1answer
73 views

Using `tree`, how do I output files before subdirectories?

I tried to combine --dirsfirst and -r, but directories still show up on top, only in reverse alphabetical order. It seems like -r is applied first, which is also indicated by the man pages. Any other ...
17
votes
5answers
15k views

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 ...
4
votes
2answers
4k views

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 ...
3
votes
1answer
167 views

Passing list of ignored directories to `tree` command [duplicate]

I'm writing a script in which I need to generate a tree of directories. How to pass to tree a variable with list of directories to ignore? And those directories are with spaces in name. I tried ...
9
votes
0answers
1k views

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 ...
4
votes
1answer
2k views

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 ...
1
vote
0answers
531 views

Create tree of processes

I'm implementing pstree as an assignment, and I would like to create test tree of processes, but I'm struggling to do so. I tried to do something like this to create tree of background processes ...
2
votes
1answer
93 views

Tree with directory name and filenames

I run with tree 1.7.0 tree -PF dat It gives . ├── 0deg/ ├── 105deg/ ├── 120deg/ ├── 135deg/ ├── 150deg/ ├── 15deg/ ├── 165deg/ ├── 180deg/ ├── 210deg/ ├── 240deg/ ├── 270deg/ ├── 300deg/ ├── ...
2
votes
2answers
300 views

Tool to add hierarchical structure to output, similar to tree

Is there a tool that is similar to tree which could be used in conjunction with echo? I want to easily prepend hierarchical structure to output. I know I could write it, but if a solution ("do one ...
2
votes
2answers
557 views

How do I display a dependency chain from one package to another?

For example, I want to find out why monodevelop does depend on systemd. apt-rdepends -r systemd shows all packages that that directly or indirectly depend on systemd: $ apt-rdepends --dotty -r ...
3
votes
2answers
2k views

The reverse of `tree` - reconstruct file and directory structure from text file contents?

We all know we can use tree to get a nicely formatted text "visualization" of the structure of a directory; say: $ tree -spugD /usr/include/boost/accumulators/numeric/ /usr/include/boost/accumulators/...