# 估算檔案系統容量使用情況 [TOC] ###### tags: `*nux` `du` --- ## 結論先行 ```shell $ du -ach /var/log ``` - `du` 命令 - `-ach` 引數 - `var/log` 指定路徑 ## 概介 - Amazon Linux 2 ``` du [OPTION]... [FILE]... ``` - Apple macOS ``` du [-Aclnx] [-H | -L | -P] [-g | -h | -k | -m] [-a | -s | -d depth] [-B blocksize] [-I mask] [-t threshold] [file ...] ``` ## 引數 | | Amazon Linux 2 | Apple macOS | | --- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `a` | write counts for all files, not just directories | Display an entry for each file in a file hierarchy. | | `c` | produce a grand total | Display a grand total. | | `h` | print sizes in human readable format (e.g., 1K 234M 2G) | "Human-readable" output. Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte based on powers of 1024. | ### `-a` 所有檔案及目錄。 ### `-c` 統計總和。 ### `-h` 易懂的單位;如 `K`、`M`、`G` 等。