Linux tree display of directories, tree command
Colleagues hello to all.
In today's article, we'll talk about a very handy tool for listing files and directories on the Linux command line called tree. This utility displays a tree-like list of files and directories in a human-readable form. The tree command recursively traverses all nested directories and files and displays information in a convenient tree-like format.
Article content:
- Installing the utility.
- Syntax of the tree command.
- Examples with the tree command.
1. Installing the utility.
The tree utility is not installed on Linux distributions and we need to install it first. To install, use the command:
$. yum install tree
2. Syntax of the tree.
command
tree [options] directory.
- -a show all files, including hidden ones.
- -d show directories only.
- -h show size of files.
- -u show owner or userid.
- -g show group or group id.
- -С turn on highlighting with different colors.
- -D show date when a file or directory was last modified.
3. Examples with the tree command.
3.1. A simple example tree of files in the current directory. To do this, execute the tree command without any arguments.
$. tree
3.2. An example tree of files and their size, for this you need to use the (-h) parameter.
$. tree -h
3.3. An example showing the directories themselves without files, for this you need to use the (-d) parameter.
$. tree -d
3.4. An example showing the date of the last modification of a file or directory, for this you need to use the (-D) parameter.
$. tree -D
3.5. An example showing the size, owner, group and modification date of files and directories.
$. tree -hugD
Thank you all, I hope that my article helped you in some way.