Latest web development tutorials

Linux tree command

Linux command Daquan Linux command Daquan

Linux tree command is used to list the contents of a directory tree.

Instruction execution tree, it will list all the files in the specified directory, including subdirectories in the file.

grammar

tree [-aACdDfFgilnNpqstux][-I <范本样式>][-P <范本样式>][目录...]

Parameter Description:

  • -a displays all files and directories.
  • -A Character display graphics using ASNI tree rather than an ASCII character combination.
  • -C In the list of files and directories plus colors, easy to distinguish between the various types.
  • -d display the directory name but not its content.
  • -D Time by changing the file or directory.
  • -f before each file or directory, display the full relative path name.
  • -F Executing files, directories, Socket, symbolic links, pipe name names, each plus "*", "/", "=", "@", "|" number.
  • -g lists the name of the file or directory belongs to a group, and when there is no corresponding name, the group ID is displayed.
  • -i not a stepped listed file or directory name.
  • -I <Style template> does not display the file or directory name matches the style template.
  • -l case of nature is a symbolic link directory, list the direct connection point to the original directory.
  • -n is not in the list of files and directories plus color.
  • -N Listed directly file and directory names, including control characters.
  • -p lists the permissions marked.
  • -P <Style template> Show only the file or directory name matches the style template.
  • -q with the "?" sign instead of the control characters listed in the file and directory names.
  • -s List file or directory size.
  • -t sort by modification time of files and directories.
  • -u lists the owner of the name of the file or directory, when no corresponding name, user ID is displayed.
  • -x limited the scope of the existing file system, if some of the subdirectories of the specified directory, which is stored on another file system, then the subdirectories to be excluded from the scope of looking outside.

Examples

To list the current directory tree structure. You can directly use the following command:

tree

This command has the following output:

# tree                   #以树状图列出当前目录结构  
.                        #当前目录结构  
|-- README  
|-- examples.desktop  
|-- file  
|-- file.new  
|-- index.htm  
|-- test  
| |-- README  
| |-- file  
| |-- testfile  
| |-- testfile1  
| |-- xaa  
| |-- xab  
| |-- xac  
| |-- xad  
| |-- xae  
| |-- xaf  
| |-- xag  
| |-- xah  
| `-- xai  
|-- test.tar.gz  
|-- test.zip  
|-- testfile  
|-- testfile.new  
|-- testfile.patch  
|-- testfile1  
|-- testfile2  
|-- testfile3  
|-- xaa  
|-- xab  
|-- xac  
|-- xad  
|-- xae  
|-- xaf  
|-- xag  
|-- xah  
|-- xai  
|-- \345\205\254\345\205\261\347\232\204  
|-- \345\233\276\347\211\207  
| |-- 075b5c2bb1628c1a5343c10a.jpg  
| |-- 0c978fe989ac787e799757095719d3c4.jpg  
| |-- 20050726194826866443.jpg  
| |-- 20061113171548785122.jpg  
| |-- 2007102221576687.jpg  
| |-- 39.jpg  
| |-- 434887ec4340916a78f0559a.jpg  
| |-- 498da016ac02fb2bc93d6d08.jpg  
| |-- 7b284f5a0f854da2f3bf90b204149a34.jpg  
| |-- 9196c030d342a68d5edf0e98.jpg  
| |-- a56c5a90de15c8a9a977a4cc.jpg  
| |-- c74f62167c9d2b244a90a79e.jpg  
| `-- img13.jpg  
|-- \346\226\207\346\241\243  
|-- \346\241\214\351\235\242  
|-- \346\250\241\346\235\277  
|-- \350\247\206\351\242\221  
`-- \351\237\263\344\271\220  
8 directories, 48 files           #统计信息,该目录共8个子目录,48个文件 

Linux command Daquan Linux command Daquan