The "Go" Linux tree command displays the file directory structure in a hierarchical structure----good

Source: Internet
Author: User

Original URL: http://jingyan.baidu.com/article/acf728fd19c7eff8e510a3eb.html

Today's gadget to share the use of a very useful command for Linux systems: The tree command can display a file directory structure in the form of trees, which is ideal for us to introduce to others the constituent framework of our file directory, and the command can be output to a text file using the appropriate parameters.

This experience shows:

This proposal for small series is only suitable for 10.10 versions of the Ubuntu system, followed by 11.04, 11.10 ... 14.04 system because the default desktop is different, so this experience is not applicable, to use, then please install the GNOME desktop

Method/Step
  1. In the Ubuntu system, the default is no tree this command, need to install, with the following command to install the tree This command tool sudo apt-get install tree

  2. First of all, to say how to use the tree This command, in fact, there is a very simple way, is to directly see the help of the tree, enter the following command, you can see the help information about the tree command tree--help

  3. Now let's talk about how to use tree, the simplest way is to directly input the tree command, will automatically give us a tree to list the current directory of files and folders, without any parameters, it will automatically list the current directory of all the depth level of files and directories

  4. Let's talk about how to look at different levels of subdirectories and files using the "Tree-l 1" command, view only the current first-level directories and files using the "Tree-l 2" command, view only the current second-level directories and files using the "tree-l N" command, View only directories and files at the current nth level

  5. The above is only to show the current results, but in many cases we want to save this directory structure information, our own or send to others, we will tell you how to achieve this goal

    Use the following command to save the directory structure information input for the second-level subdirectory of the current file to the/home/xyh/tree.txt file

    Command:

    Tree-l 2 >/home/xyh/tree.txt

  6. Below we open the/home/xyh/tree.txt file to see if the result is the same as the result of the command we used earlier, we can see that the result of saving the file is to use the "Tree-l 2" command to enter the result

The "Go" Linux tree command displays the file directory structure in a hierarchical structure----good

Related Article

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.