Did you ever need to look up a file and had no idea where it could be? Or did you want to know how a directory and its sub-directories are structured, but didn’t have any overview? This is where tree
comes in.
By running tree
you get a nicely looking directory tree, containing the current directory and all the sub-directories.
To install tree
on Arch, use the command:
#pacman -S
tree
Handy, isn’t it? But there’s more to it! If you look up the man page you see that, as an example, you can append the -l
flag to follow symbolic links or append the -f
flag to print the relative file path, which is useful if you need the relative path in your code base. Additionally, if you execute tree
for a large directory with numerous sub-directories you may limit the depth of the sub-directory traversal to e.g. 2 levels via the tree -L 2
.