zoukankan      html  css  js  c++  java
  • CentOS tree命令详解

    inux下tree命令详解---linux以树状图逐级列出目录的内容命令 
    #############################################################################
    命令格式 
    tree <选项或者是参数> <分区或者是目录> 
    #############################################################################
    (1) tree 最长使用的参数或者是选项 

    -a 显示所有文件和目录。 
    [root @liyao~]# tree -a 
    . 
    |-- .bash_logout 
    |-- .bash_profile 
    |-- .bashrc 
    |-- .cshrc 
    |-- .gconf 
    |   `-- apps 
    |       |-- %gconf.xml 
    |       `-- gnome-session 
    |           |-- %gconf.xml 
    |           `-- options 
    |               `-- %gconf.xml 
    |-- .gconfd 
    |   `-- saved_state 
    |-- .tcshrc 
    |-- anaconda-ks.cfg 
    |-- install.log 
    `-- install.log.syslog 
    **************************************************************************************
    -d 显示目录名称而非内容。 
    [root @liyao~]# tree -d 
    . 
    `-- liyao

    1 directory

    *****************************************************************************
    -f 在每个文件或目录之前,显示完整的相对路径名称。
    [root@liyao ~]# tree -f
    .
    |-- ./anaconda-ks.cfg
    |-- ./install.log
    |-- ./install.log.syslog
    `-- ./liyao
    1 directory, 3 files
    *****************************************************************************
    -F 在执行文件,目录,Socket,符号连接,管道名称名称,各自加上"*","/","=","@","|"号。
    [root@liyao ~]# tree -F 
    .
    |-- anaconda-ks.cfg
    |-- install.log
    |-- install.log.syslog
    `-- liyao/

    1 directory, 3 files
    *****************************************************************************
    -r 以相反次序排列
    [root@liyao ~]# tree -r
    .
    |-- liyao
    |-- install.log.syslog
    |-- install.log
    `-- anaconda-ks.cfg

    1 directory, 3 files
    *****************************************************************************
    -t 用文件和目录的更改时间排序。
    [root@liyao ~]# tree -t
    .
    |-- liyao
    |-- anaconda-ks.cfg
    |-- install.log
    `-- install.log.syslog

    1 directory, 3 files
    [root@liyao ~]# ls -l
    total 56
    -rw------- 1 root root  1012 Jul  3 21:43 anaconda-ks.cfg
    -rw-r--r-- 1 root root 27974 Jul  3 21:43 install.log
    -rw-r--r-- 1 root root  4708 Jul  3 21:43 install.log.syslog
    drwxr-xr-x 2 root root  4096 Jul  3 23:30 liyao
    *****************************************************************************
    -L n 只显示 n 层目录 (n 为数字)
    [root@liyao ~]# tree -L 2 
    .
    |-- anaconda-ks.cfg
    |-- install.log
    |-- install.log.syslog
    `-- liyao
       `-- baobao

    2 directories, 3 files
    *****************************************************************************
    --dirsfirst 目录显示在前文件显示在后
    [root@liyao ~]# tree --dirsfirst
    .
    |-- liyao
    |   `-- baobao
    |-- anaconda-ks.cfg
    |-- install.log
    `-- install.log.syslog

    2 directories, 3 files

    #####################################################################
    (2) 可以加的参数,但是不是经常用得到

    -A 使用ASNI绘图字符显示树状图而非以ASCII字符组合。
    -C 在文件和目录清单加上色彩,便于区分各种类型。
    -D 列出文件或目录的更改时间。
    -g 列出文件或目录的所属群组名称,没有对应的名称时,则显示群组识别码。
    -i 不以阶梯状列出文件或目录名称。
    -I 不显示符合范本样式的文件或目录名称。
    -l 如遇到性质为符号连接的目录,直接列出该连接所指向的原始目录。
    -n 不在文件和目录清单加上色彩。
    -N 直接列出文件和目录名称,包括控制字符。
    -p 列出权限标示。
    -P 只显示符合范本样式的文件或目录名称。
    -q 用"?"号取代控制字符,列出文件和目录名称。
    -s 列出文件或目录大小。
    -u 列出文件或目录的拥有者名称,没有对应的名称时,则显示用户识别码。
    -x 将范围局限在现行的文件系统中,若指定目录下的某些子目录,其存放于另一个文件系统上,则将该子目录予以排除在寻找范围外。

  • 相关阅读:
    POJ 2923 Relocation (状态压缩,01背包)
    HDU 2126 Buy the souvenirs (01背包,输出方案数)
    hdu 2639 Bone Collector II (01背包,求第k优解)
    UVA 562 Dividing coins (01背包)
    POJ 3437 Tree Grafting
    Light OJ 1095 Arrange the Numbers(容斥)
    BZOJ 1560 火星藏宝图(DP)
    POJ 3675 Telescope
    POJ 2986 A Triangle and a Circle
    BZOJ 1040 骑士
  • 原文地址:https://www.cnblogs.com/webnote/p/5744428.html
Copyright © 2011-2022 走看看