Questions tagged [tree]
The tree tag has no usage guidance.
111
questions
4
votes
1
answer
418
views
Is there a way to make tree not show the top level?
By default, tree shows this:
$ tree
.
├── Package.resolved
├── Package.swift
├── Sources
│ └── SwiftClientSDK
│ ├── OpenAPI.yaml
│ ├── SwiftClientSDK.swift
│ └── openapi-generator-...
1
vote
1
answer
18
views
Tree display hw, hw.cpp & hw.cpp2 in sub-directories
I would like tree to display the hw files in the sub-directories like this:
.
├── exp
│ └── hw
├── src
│ └── hw.cpp2
└── tmp
└── hw.cpp
$ /usr/bin/tree --noreport . displays all of the files:...
0
votes
1
answer
42
views
Command "tree -J" returns invalid Json
I gave the command tree -J to my machine, and this is a portion of the output it gave:
{
"type": "file",
"name": &...
0
votes
2
answers
194
views
Using 'TREE' for sub-subdirectories
Is it possible to use tree to create several output files without being cd ~/ into the directory I want to create a tree file?
For example, I have a directory called parent-dir.
Inside of parent-dir ...
0
votes
1
answer
271
views
tree command to only output file and directory count?
I want to keep only the last line of tree's output or the file+directory count report. Preferably, with the -a switch.
An example output I desire:
585 directories, 37722 files
Is this possible with ...
2
votes
0
answers
39
views
Is it possible to colourise the heading lines on bash tree output?
Say I have a directory structure that looks like this:
foo
|-- bar
| |-- 1
| |-- 2
| |-- 3
| |-- baz
| | |-- 4
| | |-- 5
| | |-- 6
| | |-- moo
| | | |-- 7
| | | |-- ...
0
votes
1
answer
40
views
Tree. What is the location of the generated text file?
Ubuntu. Tree.
tree -fi /path/to/the/directory >~/file.txt
I see the files in terminal but was under the impression that a text file called 'file.txt' would be generated, but I can't find it.
3
votes
1
answer
2k
views
Autocompletion not working for pass password manager in zsh in linux
I already used pass program for password managing on MacOS with zsh (where the autocompletion worked flawlessly out of the box) and now trying to move on linux on a raspberry pi 4b 4GB, installed zsh ...
1
vote
2
answers
627
views
How to use the tree command to expand only selected folder(s)?
I'm creating a script that generates a project folder into another folder along with some other module folders. I want to show how the generated project folder structure looks in the final tree but ...
1
vote
0
answers
392
views
tree command how to omit too many subfolders?
I want to preview the structure of a folder with tree -d. However, some subfolder has too many subfolders, which prevent me to preview the whole tree at a glance, so I want a argument such as --...
1
vote
1
answer
308
views
Creating .info files to be used with tree
man tree1 states:
-info Prints file comments found in .info files. See .INFO FILES below for more information on the format of .info files.
and further
.INFO FILES
.info files are similiar to ....
3
votes
2
answers
481
views
How to create a file for every directory on a tree?
For the following tree structure:
.
└── dir1
└── dir2
└── dir3
What would be a simple way to create a file (could be empty), for every directory, so the resulting tree will look like:
...
-1
votes
2
answers
729
views
tree command with icons
We all love the tree command, but it would be amazing to have the icons next to the files, as both the file browser of VSC or Color Ls have.
Does anyone know any way to implement it?
1
vote
1
answer
454
views
Display `grep -lr` results as a tree
I'm searching a large number of text files which are organized in various subdirectories. I can run a command such as grep -lr foobar ./, and I get results like the following:
./dirA/dirA.A/abc.txt
./...
0
votes
1
answer
200
views
How Do I Get `tree` to Selectively Exclude Contents of Directories?
I'm using tree on a directory which has -- among other things -- some Audacity projects in it. Each Audacity project is some file X.aup, along side a directory X_data, which contains a few sub-...
3
votes
1
answer
76
views
Print structured list to command-line (tree like)
If I have a text-file with a structured list like this:
#linux
##audio
###sequenzer
####qtractor
###drummachine
####hydrogen
##scores
###lilypond
###musescore
##bureau
###kalender
####calcurse
###...
0
votes
1
answer
2k
views
What does the output `d?????????` in `ls -l` mean? [duplicate]
What is the situation why ls -l returns a list of subdirectories in the form below?
d????????? ? ? ? ? ? Subdirectory
A tree launched on that directory returns 0 directories, 0 files for ...
0
votes
3
answers
246
views
tree command: Can you prevent the formatting dependancy on the final item?
I am using tree and diff to compare a local directory with a USB backup version of the same directory, and to identify noteworthy / discardable differences.
$ cd home/dir/
$ tree --charset=ascii -af . ...
0
votes
0
answers
48
views
What does this wecho command do?
I found a script that makes a file list. The list looks like this
/home/usr/example_directory
/home/usr/example_directory/file1.txt
/home/usr/example_directory/file2.txt
/home/usr/different_directory
/...
-1
votes
1
answer
3k
views
ls to recurse, showing full path
There are obviously many ways to do the same job in Linux, but I recently needed to for i in xxx through a list of each item, recursively in a tree. I found a solution with tree by doing tree -fail (...
0
votes
1
answer
31
views
tree: Is there a way to maintain visibility of outer level directory labels when scrolling?
When you generate a tree for a large directory base with innumerable sub-directories and associated files, with -a option, often you get a large file with thousands of lines. While traversing the tree ...
0
votes
1
answer
44
views
How to detect which files are created when running a command
I'm trying to understand what files or build artifacts are created by the build system of a C++ project.
There are 3 steps to building this project:
./autogen.sh
./configure
make
Is there a way I ...
-1
votes
1
answer
634
views
Directory structure for large amount of files [closed]
I have millions of files which filenames are SHA256 hashes of the content. Due to performance reasons I do not want to store them in a single directory. My idea is to have directory structure based on ...
0
votes
1
answer
2k
views
How to use tree with grep and find to locate files by name?
How can I use tree and either grep or find in conjunction to find, for example, csv files using ".csv" as a file extension:
├── ./Videos
├── ./vscode
│ ├── ./vscode/foo.csv
│ ├── ./...
4
votes
1
answer
799
views
Efficiently turn a directory tree into a new filesystem on zfs
I "inherited" management of a system, whose "/opt" (and some other large directory trees) are stored in the root file system.
My wish now is to create a new filesystem in the rpool ...
0
votes
1
answer
105
views
Print only files, directories containing files and empty directories
I am trying to index some LTO tapes (and some hard disks as well) and would like a simple output, stored in a text file. Something like the example below:
...
/home/norg/Desktop/empty\ dir/
/home/norg/...
2
votes
0
answers
518
views
Show files modified after a particular date ('find') in hierarchical format ('tree')
I'm trying to view files modified before or after a certain date using the hierarchical output of the Unix tree command.
For example, I know that one can use tree to sort files chronologically and ...
0
votes
1
answer
1k
views
How to find files greater than a size in linux [duplicate]
I want to find user, size, modified date and full file path of all files in sub-directories starting from a dir. I have got to following so far:
nohup sudo \
tree /work/mydir \
-sufiD \
--noreport \
--...
0
votes
2
answers
303
views
Tree structures and directories [closed]
I need to draw the tree structure of the following code.
cd /; mkdir a b c a/a b/a; cd a; mkdir ../e ../a/f ../b/a/g; cd../b/./; mkdir /a/k a/b ../a/./b /c
I know that: cd /; (goes to root) , mkdir ...
2
votes
1
answer
990
views
`tree` horizontal display
Is there an alternative to tree command (or some way using the tree command itself) to print the directory structure horizontally?
Quite often, I have a tree structure, for which I have to scroll a ...
0
votes
2
answers
891
views
What is a "path name component"? [duplicate]
I am not sure I correctly understood what is a path name component (or perhaps better written; path name-component) which I understand to be commonly abbreviated simply as "component" in the Unix &...
1
vote
2
answers
59
views
What is the most basic "depth" of any "container file"?
I use the term "container file" to describe any file which practically contains one file or two or more files. Some examples would be a tar archive or a directory.
Let's say I open a tar archive with ...
4
votes
5
answers
7k
views
How to draw a continuous line in terminal?
I've been searching for this for a while and didn't get a satisfactory answer for it.
I've taken this screenshot from the output of Gnu/Linux's tree command.
I want to know how to draw or print ...
2
votes
3
answers
1k
views
List files recursively, in alphabetical order and without lines that show exclusively folder names
How to list files recursively, in alphabetical order and without lines that show exclusively folder names?
For example, I can get the following output with tree --dirsfirst -fihan * -o filelist:
00.-...
2
votes
2
answers
437
views
Easiest way to get `+` indented `tree` output
I need to replace indentation in tree output with + signs so that instead of this:
$ tree --noreport dir
dir
├── dir1
│ ├── file1
│ └── file2
└── dir2
├── file1
└── file2
it'd print this:...
1
vote
1
answer
184
views
Confused about "tree" not finding a file
Why the last tree is not finding fstab?
tree /etc -P fstab --prune
/etc
└── fstab
0 directories, 1 file
.
tree /etc -P fsta* --prune
/etc
└── fstab
0 directories, 1 file
.
tree /etc -P *...
2
votes
1
answer
1k
views
du + tree command (without tree installation)
is there a nice way to combine:
ls -R | grep "^[.]/" | sed -e "s/:$//" -e "s/[^\/]*\//--/g" -e "s/^/ |/"
(displays directory as tree)
with
du -h ... (for each listed dir)
Without installing any ...
2
votes
2
answers
3k
views
Exclude subdirectory pattern for the tree command not working
I'm trying to use the tree command to list my current git directory.
I want to exclude every files that match a gitignore pattern.
The solution found here seems promising.
Unfortunately it seems ...
0
votes
1
answer
86
views
Copying files from specific subsubdirectories based on subdirectory name into single directory then renaming
So here's an excerpt of my directory tree:
|-- 20070214_014700.a
| |-- info
| |-- processed
| |-- HH.EL..BHZ
| |-- AZ.AS..HHZ
| |-- (hundreds more)
| |-- raw
| ...
0
votes
1
answer
133
views
How to get an output results as text to more than one location at once? [duplicate]
Is there a way that I can get a resulted output to multiple locations at the same time. ls -RsgorCh >> /Users/User1/Text1.txt will print the output as a text file in the given location. I want ...
0
votes
2
answers
605
views
How to shorten image sequence output in tree command?
I'm in a directory where running tree command produces something like this:
├── directory1
│ └── image_sequence
│ ├── image.0001.jpg
│ ├── image.0002.jpg
│ ├── image.0003.jpg
│ ...
2
votes
1
answer
3k
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 ...
2
votes
2
answers
694
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
1
answer
474
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 ...
3
votes
2
answers
1k
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
1
answer
2k
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
0
answers
99
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 ...
3
votes
1
answer
422
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
2
answers
221
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
1
answer
6k
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 ...