Linux 查看磁盤使用狀況

經過 DU/DF 能夠查看磁盤使用狀況

DU

經過搜索文件來計算每一個文件的大小而後累加,du能看到的文件只是一些當前存在的,沒有被刪除的。他計算的大小就是當前他認爲存在的全部文件大小的累加和。html

用法:du [選項]... [文件]...
 或:du [選項]... --files0-from=F
Summarize disk usage of the set of FILEs, recursively for directories.

必選參數對長短選項同時適用。
  -0, --null            end each output line with NUL, not newline
  -a, --all             write counts for all files, not just directories
      --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
  -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'
  -c, --total           produce a grand total
  -D, --dereference-args  dereference only symlinks that are listed on the
                          command line
  -d, --max-depth=N     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
      --files0-from=F   summarize disk usage of the
                          NUL-terminated file names specified in file F;
                          if F is -, then read names from standard input
  -H                    equivalent to --dereference-args (-D)
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
      --inodes          list inode usage information instead of block usage
  -k                    like --block-size=1K
  -L, --dereference     dereference all symbolic links
  -l, --count-links     count sizes many times if hard linked
  -m                    like --block-size=1M
  -P, --no-dereference  don't follow any symbolic links (this is the default)
  -S, --separate-dirs   for directories do not include size of subdirectories
      --si              like -h, but use powers of 1000 not 1024
  -s, --summarize       display only a total for each argument
  -t, --threshold=SIZE  exclude entries smaller than SIZE if positive,
                          or entries greater than SIZE if negative
      --time            show time of the last modification of any file in the
                          directory, 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, which can be:
                            full-iso, long-iso, iso, or +FORMAT;
                            FORMAT is interpreted like in 'date'
  -X, --exclude-from=FILE  exclude files that match any pattern in FILE
      --exclude=PATTERN    exclude files that match PATTERN
  -x, --one-file-system    skip directories on different file systems
      --help		顯示此幫助信息並退出
      --version		顯示版本信息並退出

所顯示的數值是來自 --block-size、DU_BLOCK_SIZE、BLOCK_SIZE 
及 BLOCKSIZE 環境變量中第一個可用的 SIZE 單位。
不然,默認單位是 1024 字節(或是 512,若設定 POSIXLY_CORRECT 的話)。

The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
請向<http://translationproject.org/team/zh_CN.html> 報告du 的翻譯錯誤
Full documentation at: <http://www.gnu.org/software/coreutils/du>
or available locally via: info '(coreutils) du invocation'

DF

經過文件系統來快速獲取空間大小的信息,當咱們刪除一個文件的時候,這個文件不 是立刻就在文件系統當中消失了,而是暫時消失了,當全部程序都不用時,纔會根據OS的規則釋放掉已 經刪除的文件, df記錄的是經過文件系統獲取到的文件的大小,他比du強的地方就是可以看到已經刪除 的文件,並且計算大小的時候,把這一部分的空間也加上了,更精確了。node

用法:df [選項]... [文件]...
Show information about the file system on which each FILE resides,
or all file systems by default.

必選參數對長短選項同時適用。
  -a, --all             include pseudo, duplicate, inaccessible file systems
  -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
  -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)
  -H, --si              print sizes in powers of 1000 (e.g., 1.1G)
  -i, --inodes		顯示inode 信息而非塊使用量
  -k			即--block-size=1K
  -l, --local		只顯示本機的文件系統
      --no-sync		取得使用量數據前不進行同步動做(默認)
      --output[=FIELD_LIST]  use the output format defined by FIELD_LIST,
                               or print all fields if FIELD_LIST is omitted.
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
      --total           elide all entries insignificant to available space,
                          and produce a grand total
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
  -v                    (ignored)
      --help		顯示此幫助信息並退出
      --version		顯示版本信息並退出

所顯示的數值是來自 --block-size、DF_BLOCK_SIZE、BLOCK_SIZE 
及 BLOCKSIZE 環境變量中第一個可用的 SIZE 單位。
不然,默認單位是 1024 字節(或是 512,若設定 POSIXLY_CORRECT 的話)。

The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).

FIELD_LIST is a comma-separated list of columns to be included.  Valid
field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',
'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info page).

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
請向<http://translationproject.org/team/zh_CN.html> 報告df 的翻譯錯誤
Full documentation at: <http://www.gnu.org/software/coreutils/df>
or available locally via: info '(coreutils) df invocation'
相關文章
相關標籤/搜索