Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the tree command in Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use the tree command in Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The Linux common command tree command is used to list the contents of the directory in a tree view and execute the tree directive, which lists all files in the specified directory, including files in the subdirectory.

Syntax tree [- aACdDfFgilnNpqstux] [- I] [- P] [directory.]

Parameter description:

-a displays all files and directories. -A displays the tree view using ASNI drawing characters instead of ASCII character combinations. -C adds colors to file and directory lists to make it easy to distinguish between different types. -d displays the directory name instead of the content. -D lists when the file or directory was changed. -f displays the full relative path name before each file or directory. -F add "*", "/", "=", "@", "|" in the execution file, directory, Socket, symbolic link, pipe name, respectively. -g lists the name of the group to which the file or directory belongs. If there is no corresponding name, the group identification number is displayed. -I do not list file or directory names in a ladder. -L level restricts the directory display level. -l if you encounter a directory with a symbolic connection, directly list the original directory that the connection points to. -n does not add color to the file and directory list. -N lists file and directory names directly, including control characters. -p lists permission tags. -P displays only file or directory names that match the template style. -Q uses "?" Instead of the control character, the file and directory names are listed. -s lists the file or directory size. -t sort by the change time of files and directories. -u lists the owner name of the file or directory, and if there is no corresponding name, the user identification number is displayed. -x limits the scope to the current file system, and if some subdirectory under the specified directory is stored on another file system, the subdirectory is excluded from the search. Example

Lists the current directory structure in a tree view. You can use the following command directly:

Tree

The command has the following output:

# tree # lists the current directory structure in a tree view. # current directory structure |-- README |-- examples.desktop |-- file |-- file.new |-- index.htm |-- test | |-- README |-- file | |-- testfile | |-- testfile1 | |-- xaa | |-- xab | |-- xac | |-- xad | |-- xae | |-- xaf |-- xag | |-- xah | `--xai |-- test.tar.gz |-- test.zip |-- | Testfile |-- testfile.new |-- testfile.patch |-- testfile1 |-- testfile2 |-- testfile2 |-- testfile3 |-- xaa |-- xab |-- xac |-- xad |-- xae |-- xaf |-- xah |-- xai |-- 345\ 205\ 254\ 345\ 261\ 347\ 232\ 204 |-- 075b5c2bb1628c1a5343c10a.jpg |-- 0c978fe989ac787e799757095719d3c4.jpg | |-20050726194826866443.jpg | | |-- 20061113171548785122.jpg | |-- 2007102221576687.jpg | |-- 39.jpg | |-- 434887ec4340916a78f0559a.jpg |-- 498da016ac02fb2bc93d6d08.jpg | |-- 7b284f5a0f854da2f3bf90b204149a34.jpg | |-- 9196c030d342a68d5edf0e98.jpg | |-- a56c5a90de15c8a9a977a4cc.jpg | |-- c74f62167c9d2b244a90a79e.jpg | `--img13.jpg |-- 346\ 226\ 207\ 346\ 241\ 243 |-- 346\ 241\ 241\ 235\ 242 |-- 346\ 250\ 241\ 235\ 277 |-- -\ 350\ 247\ 206\ 351\ 242\ 221 `- -\ 351\ 237\ 263\ 344\ 271\ 220 8 directories 48 files # Statistics The directory has 8 subdirectories and 48 files

This is the end of this article on "how to use tree commands in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report