du -- disk usage

來源:互聯網
上載者:User

標籤:des   cWeb   style   blog   http   color   java   os   使用   

du的英文為:disk usage,含義是磁碟空間使用方式,功能是逐級進入指定目錄的每一個子目錄並顯示該目錄佔用檔案系統資料區塊的情況,如果沒有指定目錄,則對當前的目錄進行統計。

面對對象時目錄檔案,而不是其他普通檔案

NAME
       du - estimate file space usage

SYNOPSIS
       du [OPTION]... [FILE]...
       du [OPTION]... --files0-from=F

DESCRIPTION
       Summarize disk usa-- 只顯示大小大於SIZE的目錄檔案

 

 

ge of each FILE, recursively for directories.

       Mandatory arguments to long options are mandatory for short options too.

(一)顯示單位選項:

-B, --block-size=SIZE scale sizes by SIZE before printing them.  E.g., ‘-BM‘ prints sizes in units of 1,048,576 bytes.  See SIZE format below.(總的用法)

     -b, --bytes
              equivalent to ‘--apparent-size --block-size=1‘

  -k     like --block-size=1K
     -m     like --block-size=1M
       -h, --human-readable
              print sizes in human readable format (e.g., 1K 234M 2G) (來個自動選擇顯示單位,類似與free命令)
       --apparent-size
              print  apparent  sizes,  rather  than  disk  usage;  although  the apparent size is usually smaller, it may be larger due to holes in
              (‘sparse‘) files, internal fragmentation, indirect blocks, and the like

       -c, --total             produce a grand total  -- 最後顯示總的空間大小
(此處牽扯到一個概念:實際檔案大小與disk usage的差別)

(二)範圍圈定選項(選出符合特定條件的檔案):

I.深度:

       -d, --max-depth=N      -- 指定統計的檔案的深度 (有點類似與find的一個參數)
              print the total for a directory (or file, with --all)  only  if
              it  is  N  or  fewer  levels  below  the command line argument;
              --max-depth=0 is the same as --summarize

II.大小

       -t, --threshold=SIZE    
              exclude  entries  smaller  than  SIZE  if  positive, or entries
              greater than SIZE if negative

 

1 +SIZE (K | M | G ...) 只顯示大小大於SIZE的目錄檔案2 -SIZE   (K | M | G ... ) 只顯示大小小於SIZE的目錄檔案

 

 

 

III.時間

       --time show time of the last modification of any file  in  the  direc‐
              tory, or any of its subdirectories

       --time=WORD
              show  time as WORD instead of modification time: atime, access,
              use, ctime or status

       --time-style=STYLE
              show times using style STYLE: full-iso, long-iso, iso,  +FORMAT
              FORMAT is interpreted like ‘date‘
顯示時間一覽中,指定顯示的特定時間是   atime access use ctime or status

嚴格來說這個選項不是起到範圍排除的作用只是一個附加項

IV.exclude

       -X, --exclude-from=FILE    這個沒看懂
              exclude files that match any pattern in FILE

       --exclude=PATTERN           任何符合PATTERN的目錄均不在顯示之列(可以使用萬用字元來擴充)
              exclude files that match PATTERN 

       -x, --one-file-system
              skip directories on different file systems
PATTERNS
       PATTERN is a shell pattern (not a regular expression).  The pattern  ?
       matches  any  one character, whereas * matches any string (composed of
       zero, one or multiple characters).  For example, *.o  will  match  any
       files whose names end in .o.  Therefore, the command

              du --exclude=‘*.o‘

       will  skip  all  files  and subdirectories ending in .o (including the
       file .o itself).
對於PATTERN可以使用萬用字元進行匹配(不是Regex)這是個很有用的選項。

 

du -- disk usage

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.