Linux: View Directory as Tree
tree prints a dir in a visual tree format, similar to
pstree for processes.
sudo apt-get install tree
For example, here's a tree view of
Tree view is useful, for example:
- Get overview of the dir structure of a large project.
- You need to organize your files and see each's file size.
Here's some of the most useful options.
-f→ show full path.
-L level→ specify depth.
-P pattern→ using wildcard to match file names to limit listing. For example,
-P '*html'to show only html files. Note: this will still show directories even if it doesn't contain matching file.
-d→ show dirs only.
-r→ reverse order.
-t→ sort output by last modification time.
--dirsfirst→ list dir before files.
--filelimit n→ don't go into dir that's more than n files.
-F→ display file type indicator. For example, “/” for dir, “*” for executable, etc.
-p→ show file perm and type.
-h→ print file size in human readable format.
man tree for more options.
Another useful command is
du. See: Linux: Show Directory Size: du.