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
- 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
- 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
- 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
- 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/
- 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
- 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
- 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