CentOS tree命令詳解

來源:互聯網
上載者:User

標籤:

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 在每個檔案或目錄之前,顯示完整的相對路徑名稱。
[[email protected] ~]# tree -f
.
|-- ./anaconda-ks.cfg
|-- ./install.log
|-- ./install.log.syslog
`-- ./liyao
1 directory, 3 files
*****************************************************************************
-F 在執行檔案,目錄,Socket,符號串連,管道名稱名稱,各自加上"*","/","=","@","|"號。
[[email protected] ~]# tree -F 
.
|-- anaconda-ks.cfg
|-- install.log
|-- install.log.syslog
`-- liyao/

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

1 directory, 3 files
*****************************************************************************
-t 用檔案和目錄的更改時間排序。
[[email protected] ~]# tree -t
.
|-- liyao
|-- anaconda-ks.cfg
|-- install.log
`-- install.log.syslog

1 directory, 3 files
[[email protected] ~]# 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 為數字)
[[email protected] ~]# tree -L 2 
.
|-- anaconda-ks.cfg
|-- install.log
|-- install.log.syslog
`-- liyao
   `-- baobao

2 directories, 3 files
*****************************************************************************
--dirsfirst 目錄顯示在前檔案顯示在後
[[email protected] ~]# 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 將範圍局限在現行的檔案系統中,若指定目錄下的某些子目錄,其存放於另一個檔案系統上,則將該子目錄予以排除在尋找範圍外。

CentOS tree命令詳解

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.