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 implement tree Command in linux

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

Share

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

This article mainly shows you "how to achieve tree commands in linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve tree commands in linux" this article.

The tree command is the protagonist of printing files and directories in a graphical tree structure. This command is usually not included in linux distributions. You need to install it yourself with the package manager.

Example:

1. Tree

Print all files in the current directory

2. Tree-p ${dir}

Print all the files in the dir directory and their permissions

3. Tree-h ${dir}

Print all the files in the dir directory and the readable size

4. Tree path-P "* .sh"

Print all files ending with .sh

5. Tree path-H http://localhost-o out.html

Html file containing the output of the directory tree

Interpretation-- help

Usage: tree [- adfghilnpqrstuvxACDFNS] [- H baseHREF] [- T title] [- L level [- R]]

[- P pattern] [- I pattern] [- o filename] [--version] [--help] [--inodes]

[--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset]

[--filelimit #] []

-a list of all files

-d is just a directory

-l symbolic links like directories

-f prints the full path prefix for each file.

-I do not print indentation lines

What are the unprintable characters of-Q printing?

-N print non-printable characters are is.

-p permission to print each file

-u shows the file owner or uid

-g shows the owner of the file or gid

-s print the size of each file

-h prints a file size that is more suitable for human readability.

-D prints the last modified date

-F append'/','=','*'or'|'as according to ls-F

-v sort files according to alphanumeric

-r arrange files in reverse alphanumeric order

-t sort files according to the last time

-x only stays on the current file system

-L level retroactive level level printing

-A print pattern indentation line

-S print character indentation line

-n always turns off color (- C override).

-C Open Color

-P pattern lists only those that match the regular expression

-I pattern does not list objects that match regular expressions

-H baseHREF Prints out HTML format with baseHREF as top directory. Print HMTL in basic href format as top-level directory

-T string Replace the default HTML title and H1 header with string. Replace the default HTML title and H1 title with a string

-R Rerun tree when max dir level reached. Replay the tree when it reaches the deepest directory level

-o file output to file instead of output stream

-- inodes prints the number of nodes per file

-- device Print device ID number to which each file belongs. Print the ID number of each file

-- noreport Turn off file/directory count at end of tree listing. Close the file or directory statistics at the end of the tree list

-- nolinks Turn off hyperlinks in HTML output. Close the hyperlink to the output of HTML

-- dirsfirst List directories before files. Print the directory before listing the files

-- charset X Use charset X for HTML and indentation line output. Specify character set X for HTML and indentation lines as output

-- filelimit # Do not descend dirs with more than # files in them. Directory traceability does not exceed # (directory name)

Interpretation:

1.-v-r

Arrange files in positive or reverse order according to letters or numbers

2.-L level or-- filelimit #

It's all the level of the traceability catalog.

3.-x

Tree-x ${dir} prints only the current level of directory information

The above is all the contents of the article "how to implement tree commands in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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