The contents of the directory are listed in a tree so that you can see them at a glance
Execute the tree command, which lists all files in the specified directory, including files in subdirectories.
The installation
We can easily install it through the package management tool
- mac –
brew install tree
- Debian series –
apt install tree
- CentOS –
yum - -y install tree
use
Tree [-aacddffGilNnpqSTUx][-i < template style >][-p < template style >][directory…]
Common commands
- -a Displays all files and directories.
- -c Add colors to the file and directory lists to distinguish different types.
- -d Lists the change time of files or directories.
- -f Displays complete relative path names before each file or directory.
- -s Lists file or directory sizes.
- -t Sorts files and directories by change time.
For example, run the tree-acdft command
Other commands
- -a Displays tree graphs using ASNI drawing characters instead of ASCII character combinations.
- -d Displays the directory name instead of the content.
- – F in the executable files, directories, Socket, symbolic links, pipeline name names, each with “*”, “/”, “=”, “@”, “|”.
- -g Lists the group name of a file or directory. If no group name exists, the group identification code is displayed.
- -i Does not list file or directory names in ladder form.
- -i Does not display file or directory names that match the template style.
- -l If a directory is a symbolic link, the directory to which the link points is directly listed.
- -n Directly lists file and directory names, including control characters.
- -p Lists permission labels.
- -p Displays only file or directory names that match the template style.
- – q with “?” The sign replaces the control character to list file and directory names.
- -u Lists the name of the owner of a file or directory. If no corresponding name exists, the user id is displayed.
- -x limits the search scope to the current file system. If some subdirectories in a specified directory are stored on another file system, the subdirectories are excluded from the search scope.
More tips are available at tree-help
Using the alias
Aliases allow you to customize directives, such as the author’s Settings
alias tree='tree -aC'
alias tree2='tree -L 2'
alias tree3='tree -L 3'Copy the code
In this way, tree2 can achieve the same input as tree-ACL 2
More and more
For more excellent tools, please follow the wechat public account to obtain
This article is published by OpenWrite!