Use of the tree command

Source: Internet
Author: User
Tags control characters printable characters

Some of the work done under Linux is more efficient than under Windows!

Both Windows and Linux have the tree command, the main function is to create a list of files, all the files are listed in the form of a tree

Windows tree compared to garbage, only two parameters,/F is recursive display of each folder name,/A is using ASCII characters instead of extended characters, it is better not to add the/a parameter.

Linux tree is more powerful, but the general system does not bring this command, you need to manually download the installation: sudo apt-get install tree. File is small, only 31K, but the function can be powerful!

Parameter interpretation of the tree command, excerpt from http://www.linuxso.com/command/tree.html

-a displays all files and directories.
-A uses Asni drawing characters to display a tree instead of an ASCII character combination.
-C adds color to the list of files and directories, making it easy to differentiate between types.
-D Displays the directory name instead of the content.
-D lists the time that the file or directory was changed.
-F Displays the full relative path name before each file or directory.
-F in executing files, directories, sockets, symbolic connections, pipe name names, respectively plus "*", "/", "=", "@", "|" No.
-g lists the name of the group to which the file or directory belongs, and when there is no corresponding name, the group identifier is displayed.
-I does not list the file or directory name in a ladder form.
-I does not display file or directory names that conform to the template style.
-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 list of files and directories.
-N lists file and directory names directly, including control characters.
-p lists the permission marks.
-P displays only the file or directory name that conforms to the template style.
-Q with "?" control characters, listing file and directory names.
-s lists the file or directory size.
-T is sorted with file and directory change times.
-U Lists the owner name of the file or directory, and the user ID is displayed when there is no corresponding name.
-X limits the scope to the current file system, and if some subdirectories under the specified directory reside on another file system, the subdirectory is excluded from the search scope.

Not all of the above, the complete help message is this:

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 #] [<directory List>]
-A All files is listed.
-D List directories only.
-L Follow symbolic links like directories.
-F Print The full path prefix for each file.
-I Don ' t print indentation lines.
-Q Print non-printable characters as '? '.
-N Print non-printable characters as is.
-P Print The protections for each file.
-U displays file owner or UID number.
-G Displays file group owner or GID number.
-S Print the size in bytes of each file.
-H Print the size in a more human readable the.
-D Print The date of last modification.
-F Appends '/', ' = ', ' * ', or ' | ' as per ls-f.
-V Sort files alphanumerically by version.
-R Sort files in reverse alphanumeric order.
-T Sort files by last modification time.
-X stay on current filesystem only.
-L level Descend-directories deep.
-A Print ANSI lines graphic indentation lines.
-S Print with ASCII graphics indentation lines.
-N Turn colorization off always (-C overrides).
-C Turn colorization on always.
-P pattern List only those files that match the pattern given.
-I pattern do not list files that match the given pattern.
-H basehref Prints out HTML format with BaseHref as top directory.
-T string Replace the default HTML title and H1 header with string.
-R rerun tree when Max dir level reached.
-o file Output to file instead of stdout.
--inodes Print inode number of each file.
--device Print device ID number to which each file belongs.
--noreport Turn off File/directory count at end of tree listing.
--nolinks Turn off hyperlinks in HTML output.
--dirsfirst List directories before files.
--charset x use CharSet X for HTML and indentation line output.

--filelimit # do not descend dirs with more than # files in them.

Many parameters, the use is also very flexible, according to their own needs to choose it.

Use the tree command to generate a structure

Use the following command separately: Tree, tree/f command, you can see the effect of the screen, you can also use commands such as tree/a to generate the desired file directory.

Export the generated file directory

With the tree/f > Tree.txt command, the resulting file directory tree can be written to the Tree.txt file, tree.txt the file name can be modified. Open the corresponding file directory, you can see a tree.txt file, where the contents of the tree file, and the content of the screen output is consistent, you can later use the tree command to generate a file directory of trees structure.

In order to facilitate everyone, I put this command in the network disk back up a: http://ma6174.ys168.com/, under the Linux software directory, you can download to the USB stick, in case the computer is not connected to the Internet can be used! The usage is simple, go to the directory where the tree is located, and use the./tree command to run the same parameter.

Use of the tree command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.