From 8f248ac4d202eaffe22c9cb497e3303ba77cb8f6 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Tue, 29 Oct 2019 16:28:37 -0500 Subject: [PATCH] Add Display The Contents Of A Directory As A Tree as a unix til --- README.md | 3 +- ...y-the-contents-of-a-directory-as-a-tree.md | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 unix/display-the-contents-of-a-directory-as-a-tree.md diff --git a/README.md b/README.md index 357bd0e..41a2745 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_859 TILs and counting..._ +_860 TILs and counting..._ --- @@ -762,6 +762,7 @@ _859 TILs and counting..._ - [Curling With Basic Auth Credentials](unix/curling-with-basic-auth-credentials.md) - [Display All The Terminal Colors](unix/display-all-the-terminal-colors.md) - [Display Free Disk Space](unix/display-free-disk-space.md) +- [Display The Contents Of A Directory As A Tree](unix/display-the-contents-of-a-directory-as-a-tree.md) - [Do Not Overwrite Existing Files](unix/do-not-overwrite-existing-files.md) - [Exclude A Directory With Find](unix/exclude-a-directory-with-find.md) - [Figure Out The Week Of The Year From The Terminal](unix/figure-out-the-week-of-the-year-from-the-terminal.md) diff --git a/unix/display-the-contents-of-a-directory-as-a-tree.md b/unix/display-the-contents-of-a-directory-as-a-tree.md new file mode 100644 index 0000000..bcfeedd --- /dev/null +++ b/unix/display-the-contents-of-a-directory-as-a-tree.md @@ -0,0 +1,38 @@ +# Display The Contents Of A Directory As A Tree + +The [`exa` utility](https://github.com/ogham/exa) is a speedy replacement for +`ls` that offers some additional features. One of those extra features is the +_tree_ display. + +By including the `-T` (or `--tree`) flag, `exa` will recurse into a directory +and display the entirety of the contents as a tree. + +```bash +❯ exa -T +. +├── folder1 +│ ├── cats +│ │ └── sneaky +│ └── dogs +│ └── fido +└── folder2 + ├── cats + │ ├── oreo + │ └── sneaky + └── dogs + └── fido +``` + +You can target a specific directory: + +```bash +❯ exa -T folder2 +folder2 +├── cats +│ ├── oreo +│ └── sneaky +└── dogs + └── fido +``` + +See `man exa` for more details.