$TREE The $ tree command is a shell (Unix/Linux/macOS) command used to display the directory structure of a path or the current working directory as a tree. It gives a visual representation of folders and subfolders in a nested format.
โธป
๐ Basic Usage
$ tree
This will recursively list directories and files in the current directory in a tree-like format.
โธป
๐ง Example Output
$ tree
.
โโโ file1.txt
โโโ dir1
โ โโโ file2.txt
โ โโโ subdir1
โ โโโ file3.txt
โโโ dir2
โโโ file4.txt
โธป
โ Useful Options
Option Description
-L <n> Limit display to <n> levels of directories.
-d List directories only.
-a Show hidden files (those starting with .).
-f Print full path for each file.
--dirsfirst List directories before files.
-h Print sizes in human-readable format.
โธป
๐ฆ Install tree (if not already installed)
โข Ubuntu/Debian:
sudo apt install tree
โข Fedora:
sudo dnf install tree
โข macOS (with Homebrew):
brew install tree
โธป
Let me know if you want help visualizing a specific directory or want to combine it with other shell commands!
โธป
๐ Basic Usage
$ tree
This will recursively list directories and files in the current directory in a tree-like format.
โธป
๐ง Example Output
$ tree
.
โโโ file1.txt
โโโ dir1
โ โโโ file2.txt
โ โโโ subdir1
โ โโโ file3.txt
โโโ dir2
โโโ file4.txt
โธป
โ Useful Options
Option Description
-L <n> Limit display to <n> levels of directories.
-d List directories only.
-a Show hidden files (those starting with .).
-f Print full path for each file.
--dirsfirst List directories before files.
-h Print sizes in human-readable format.
โธป
๐ฆ Install tree (if not already installed)
โข Ubuntu/Debian:
sudo apt install tree
โข Fedora:
sudo dnf install tree
โข macOS (with Homebrew):
brew install tree
โธป
Let me know if you want help visualizing a specific directory or want to combine it with other shell commands!