Use of tree commands

Source: Internet
Author: User
Tags printable characters

Some jobs completed in Linux are more efficient than those completed in windows!

Both Windows and Linux have tree commands. The main function is to create a file list and list all files as trees.

Tree in Windows is relatively junk, with only two parameters./f indicates recursively displaying the name of each folder;/A indicates using ASCII characters instead of extended characters, it is better not to add the/a parameter.

The tree in Linux is relatively powerful, but the general system does not come with this command, you need to manually download and install: sudo apt-Get install tree. The file is small and only 31 KB, but it is powerful!

Tree Command Parameter explanation, from http://www.linuxso.com/command/tree.html

-A: displays all files and directories.
-A uses asni plot characters to display tree charts instead of ASCII character combinations.
-C adds colors to the file and directory list to distinguish between different types.
-D: displays the directory name rather than the content.
-D: list the change time of a file or directory.
-F displays the complete relative path name before each file or directory.
-F adds "*", "/", "=", "@", "|" to the execution file, directory, socket, symbolic connection, and MPs queue name.
-G lists the group names of files or directories. If no corresponding name exists, the Group ID is displayed.
-I does not list file or directory names in steps.
-I does not display the name of the file or directory that meets the template style.
-L if a directory with a symbolic connection is encountered, the original directory pointed to by the connection is directly listed.
-N does not add colors to the file and directory list.
-N: directly lists the file and directory names, including control characters.
-P: list the permission IDs.
-P Only displays the names of files or directories that conform to the template style.
-Q: Use "? "To replace the control character to list the file and directory names.
-S: list the file or directory size.
-T sort by the change time of files and directories.
-U indicates the name of the owner of a file or directory. If no corresponding name exists, the user ID is displayed.
-X limits the range to the current file system. If some subdirectories in the specified directory are stored in another file system, this subdirectory is excluded from the search range.

The above column is not very complete. The complete help information is as follows:

Usage: tree [-adfghilnpqrstuvxacdfns] [-H basehref] [-T title] [-l level [-R]
[-P pattern] [-I pattern] [-O filename] [-- version] [-- help] [-- inodes]
[-- Device] [-- noreport] [-- nolinks] [-- dirsfirst] [-- charset]
[-- Filelimit #] [ < Directory List > ]
-A all files are 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 '? '.
-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 way.
-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 only level 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.

There are many parameters and the usage is flexible. Choose one based on your needs.

In order to facilitate everyone, I put this command in the network disk back up A: http://ma6174.ys168.com/, in the Linux software directory, you can download to the U disk, in case the computer is not connected to the network can also be used! The usage is very simple. Go to the directory where the tree file is located and run it using the./Tree Command. The parameters are the same.

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.