Linux Directory Operations Command tree

Source: Internet
Author: User
Tags control characters

Linux Directory Operations Command tree New Linux operations, Common command directory

      • Tree command
        • Grammar
        • Options
        • Parameters
        • Instance

Tree command

The LS command displays the contents of the directory as a directory tree.

Grammar

tree(选项)(参数)

Options
    • -A: Displays all files and directories;
    • -A: Use Asni drawing characters to display the tree instead of the ASCII character combination;
    • C: In the list of files and directories to add color, easy to distinguish between various types;
    • -D: First directory name instead of content;
    • -D: Lists the time the file or directory was changed;
    • -F: Displays the full relative path name before each file or directory;
    • -F: In the execution of 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;
    • -L: If you encounter a directory with a symbolic connection, directly list the original directory that the connection points to;
    • -N: Do 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:< template style > show only file and directory names that conform to the template style;
    • -Q: With "? "Number replaces the control character, listing the file and directory name;
    • -S: Lists the file and directory size;-T: Sorts the file and directory change times;
    • -U: Lists the name of the owner of the file or directory, and displays the user ID when there is no corresponding name;
    • -X: Confine the scope to the current file system, and if some subdirectories under the specified directory reside on another file system, the directory is excluded from the search scope.
    • -L: followed by a number, the number 1 refers to the next level directory.
Parameters

Files or directories that can be specified, or files or directories if not added

Instance
    1. Show All files and directories
[[email protected] tmp]# tree -a mylinux/ |head -9 mylinux/|-- etc|   |-- dbus-1|   |   `-- system.d|   |       `-- cups.conf|   |-- gshadow|   |-- ld.so.conf.d|   |   `-- kernel-2.6.32-358.el6.x86_64.conf|   |-- pam.d
    1. Use Asni drawing characters to display a tree view instead of a combination of ASCII characters
[[email protected] tmp]# tree -A mylinux/ |head -9mylinux/+-- etc|   +-- dbus-1|   |   +-- system.d|   |       +-- cups.conf|   +-- gshadow|   +-- ld.so.conf.d|   |   +-- kernel-2.6.32-358.el6.x86_64.conf|   +-- pam.d
    1. Add color to the list of files and catalogs to make it easy to differentiate between types


Enter description here
4. List the time when the file or directory was changed;

[[email protected] tmp]# tree -D mylinux/ |head -9 mylinux/|-- [May 20 14:21]  etc|   |-- [May 20 14:21]  dbus-1|   |   `-- [May 20 14:21]  system.d|   |       `-- [May 20 14:21]  cups.conf|   |-- [May 20 14:21]  gshadow|   |-- [May 20 14:21]  ld.so.conf.d|   |   `-- [May 20 14:21]  kernel-2.6.32-358.el6.x86_64.conf|   |-- [May 20 14:21]  pam.d
    1. Displays the full relative path name before each file or directory;:
[[email protected] tmp]# tree -f mylinux/ |head -9 mylinux|-- mylinux/etc|   |-- mylinux/etc/dbus-1|   |   `-- mylinux/etc/dbus-1/system.d|   |       `-- mylinux/etc/dbus-1/system.d/cups.conf|   |-- mylinux/etc/gshadow|   |-- mylinux/etc/ld.so.conf.d|   |   `-- mylinux/etc/ld.so.conf.d/kernel-2.6.32-358.el6.x86_64.conf|   |-- mylinux/etc/pam.d

6. In the execution of files, directories, sockets, symbolic connections, pipe name names, respectively plus "*", "/", "@", "|" No.

[[email protected] tmp]# tree -F mylinux/ |head -9 mylinux/|-- etc/|   |-- dbus-1/|   |   `-- system.d/|   |       `-- cups.conf|   |-- gshadow|   |-- ld.so.conf.d/|   |   `-- kernel-2.6.32-358.el6.x86_64.conf|   |-- pam.d/
    1. Lists the name of the group to which the file or directory belongs, and when there is no corresponding name, displays the group ID
[[email protected] tmp]# tree -g mylinux/ |head -9mylinux/|-- [root    ]  etc|   |-- [root    ]  dbus-1|   |   `-- [root    ]  system.d|   |       `-- [root    ]  cups.conf|   |-- [root    ]  gshadow|   |-- [root    ]  ld.so.conf.d|   |   `-- [root    ]  kernel-2.6.32-358.el6.x86_64.conf|   |-- [root    ]  pam.d
    1. If you encounter a directory with a symbolic connection, directly list the original directory that the connection points to;
[[email protected] mnt]# tree -l /mnt/mnt|-- 2|-- file1|-- file22222|-- history`-- passwd -> /tmp/mylinux/etc/gshadow0 directories, 5 files

9. List the permission signs:

[[email protected] mnt]# tree -p /etc |head -9 /etc|-- [drwxr-xr-x]  ConsoleKit|   |-- [drwxr-xr-x]  run-seat.d|   |-- [drwxr-xr-x]  run-session.d|   `-- [drwxr-xr-x]  seats.d|       `-- [-rw-r--r--]  00-primary.seat|-- [-rw-r--r--]  DIR_COLORS|-- [-rw-r--r--]  DIR_COLORS.256color|-- [-rw-r--r--]  DIR_COLORS.lightbgcolor
    1. Lists the owner name of the file or directory, and displays the user ID when there is no corresponding name:
[[email protected] mnt]# tree -u /etc |head -9 /etc|-- [root    ]  ConsoleKit|   |-- [root    ]  run-seat.d|   |-- [root    ]  run-session.d|   `-- [root    ]  seats.d|       `-- [root    ]  00-primary.seat|-- [root    ]  DIR_COLORS|-- [root    ]  DIR_COLORS.256color|-- [root    ]  

Linux Directory Operations Command tree

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.