1. 程式人生 > >Linux ls命令是如何快速得到資料夾大小的

Linux ls命令是如何快速得到資料夾大小的

先給自己挖個坑,後面慢慢填
在ls的原始碼中,通過下面的程式碼得到檔案的塊數,但是沒有找到ST_NBLOCKS是什麼東西

      blocks = ST_NBLOCKS (f->stat);

然後就發現,原來ls得到的目錄大小是假的,這這是目錄這個檔案佔用的磁碟大小,子資料夾都沒有統計。

這篇文章(linux中ls原始碼簡單分析)說得挺好的,還有這篇(4.12 st_size、st_blksize和st_blocks成員-檔案尺寸)的一個小Demo,很方便理解。
ls除開格式控制相關的東西,其他的其實並不是很高深。
原始碼,我這裡看有5000多行,貼出來佔個字數吧!
原始碼的下載方式,參考文章:

linux下ls,pwd,cp等原始碼的下載
這裡備份一下,感覺以後會用得著

dpkg -S `which ls`
apt-get -d source "coreutils"
/* 'dir', 'vdir' and 'ls' directory listing programs for GNU.
   Copyright (C) 1985-2017 Free Software Foundation, Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
/* If ls_mode is LS_MULTI_COL, the multi-column format is the default regardless of the type of output device. This is for the 'dir' program. If ls_mode is LS_LONG_FORMAT, the long format is the default regardless of the type of output device. This is for the 'vdir' program. If ls_mode is LS_LS, the output format depends on whether the output device is a terminal. This is for the 'ls' program. */
/* Written by Richard Stallman and David MacKenzie. */ /* Color support by Peter Anvin <[email protected]> and Dennis Flaherty <[email protected]> based on original patches by Greg Lee <[email protected]>. */ #include <config.h> #include <sys/types.h> #include <termios.h> #if HAVE_STROPTS_H # include <stropts.h> #endif #include <sys/ioctl.h> #ifdef WINSIZE_IN_PTEM # include <sys/stream.h> # include <sys/ptem.h> #endif #include <stdio.h> #include <assert.h> #include <setjmp.h> #include <pwd.h> #include <getopt.h> #include <signal.h> #include <selinux/selinux.h> #include <wchar.h> #if HAVE_LANGINFO_CODESET # include <langinfo.h> #endif /* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is present. */ #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 # define sigprocmask(How, Set, Oset) /* empty */ # define sigset_t int # if ! HAVE_SIGINTERRUPT # define siginterrupt(sig, flag) /* empty */ # endif #endif /* NonStop circa 2011 lacks both SA_RESTART and siginterrupt, so don't restart syscalls after a signal handler fires. This may cause colors to get messed up on the screen if 'ls' is interrupted, but that's the best we can do on such a platform. */ #ifndef SA_RESTART # define SA_RESTART 0 #endif #include "system.h" #include <fnmatch.h> #include "acl.h" #include "argmatch.h" #include "dev-ino.h" #include "die.h" #include "error.h" #include "filenamecat.h" #include "hard-locale.h" #include "hash.h" #include "human.h" #include "filemode.h" #include "filevercmp.h" #include "idcache.h" #include "ls.h" #include "mbswidth.h" #include "mpsort.h" #include "obstack.h" #include "quote.h" #include "smack.h" #include "stat-size.h" #include "stat-time.h" #include "strftime.h" #include "xdectoint.h" #include "xstrtol.h" #include "areadlink.h" #include "mbsalign.h" #include "dircolors.h" #include "xgethostname.h" #include "c-ctype.h" #include "canonicalize.h" /* Include <sys/capability.h> last to avoid a clash of <sys/types.h> include guards with some premature versions of libcap. For more details, see <https://bugzilla.redhat.com/483548>. */ #ifdef HAVE_CAP # include <sys/capability.h> #endif #define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \ : (ls_mode == LS_MULTI_COL \ ? "dir" : "vdir")) #define AUTHORS \ proper_name ("Richard M. Stallman"), \ proper_name ("David MacKenzie") #define obstack_chunk_alloc malloc #define obstack_chunk_free free /* Return an int indicating the result of comparing two integers. Subtracting doesn't always work, due to overflow. */ #define longdiff(a, b) ((a) < (b) ? -1 : (a) > (b)) /* Unix-based readdir implementations have historically returned a dirent.d_ino value that is sometimes not equal to the stat-obtained st_ino value for that same entry. This error occurs for a readdir entry that refers to a mount point. readdir's error is to return the inode number of the underlying directory -- one that typically cannot be stat'ed, as long as a file system is mounted on that directory. RELIABLE_D_INO encapsulates whether we can use the more efficient approach of relying on readdir-supplied d_ino values, or whether we must incur the cost of calling stat or lstat to obtain each guaranteed-valid inode number. */ #ifndef READDIR_LIES_ABOUT_MOUNTPOINT_D_INO # define READDIR_LIES_ABOUT_MOUNTPOINT_D_INO 1 #endif #if READDIR_LIES_ABOUT_MOUNTPOINT_D_INO # define RELIABLE_D_INO(dp) NOT_AN_INODE_NUMBER #else # define RELIABLE_D_INO(dp) D_INO (dp) #endif #if ! HAVE_STRUCT_STAT_ST_AUTHOR # define st_author st_uid #endif enum filetype { unknown, fifo, chardev, directory, blockdev, normal, symbolic_link, sock, whiteout, arg_directory }; /* Display letters and indicators for each filetype. Keep these in sync with enum filetype. */ static char const filetype_letter[] = "?pcdb-lswd"; /* Ensure that filetype and filetype_letter have the same number of elements. */ verify (sizeof filetype_letter - 1 == arg_directory + 1); #define FILETYPE_INDICATORS \ { \ C_ORPHAN, C_FIFO, C_CHR, C_DIR, C_BLK, C_FILE, \ C_LINK, C_SOCK, C_FILE, C_DIR \ } enum acl_type { ACL_T_NONE, ACL_T_LSM_CONTEXT_ONLY, ACL_T_YES }; struct fileinfo { /* The file name. */ char *name; /* For symbolic link, name of the file linked to, otherwise zero. */ char *linkname; /* For terminal hyperlinks. */ char *absolute_name; struct stat stat; enum filetype filetype; /* For symbolic link and long listing, st_mode of file linked to, otherwise zero. */ mode_t linkmode; /* security context. */ char *scontext; bool stat_ok; /* For symbolic link and color printing, true if linked-to file exists, otherwise false. */ bool linkok; /* For long listings, true if the file has an access control list, or a security context. */ enum acl_type acl_type; /* For color listings, true if a regular file has capability info. */ bool has_capability; /* Whether file name needs quoting. tri-state with -1 == unknown. */ int quoted; }; #define LEN_STR_PAIR(s) sizeof (s) - 1, s /* Null is a valid character in a color indicator (think about Epson printers, for example) so we have to use a length/buffer string type. */ struct bin_str { size_t len; /* Number of bytes */ const char *string; /* Pointer to the same */ }; #if ! HAVE_TCGETPGRP # define tcgetpgrp(Fd) 0 #endif static size_t quote_name (char const *name, struct quoting_options const *options, int needs_general_quoting, const struct bin_str *color, bool allow_pad, struct obstack *stack, char const *absolute_name); static size_t quote_name_buf (char **inbuf, size_t bufsize, char *name, struct quoting_options const *options, int needs_general_quoting, size_t *width, bool *pad); static char *make_link_name (char const *name, char const *linkname); static int decode_switches (int argc, char **argv); static bool file_ignored (char const *name); static uintmax_t gobble_file (char const *name, enum filetype type, ino_t inode, bool command_line_arg, char const *dirname); static const struct bin_str * get_color_indicator (const struct fileinfo *f, bool symlink_target); static bool print_color_indicator (const struct bin_str *ind); static void put_indicator (const struct bin_str *ind); static void add_ignore_pattern (const char *pattern); static void attach (char *dest, const char *dirname, const char *name); static void clear_files (void); static void extract_dirs_from_files (char const *dirname, bool command_line_arg); static void get_link_name (char const *filename, struct fileinfo *f, bool command_line_arg); static void indent (size_t from, size_t to); static size_t calculate_columns (bool by_columns); static void print_current_files (void); static void print_dir (char const *name, char const *realname, bool command_line_arg); static size_t print_file_name_and_frills (const struct fileinfo *f, size_t start_col); static void print_horizontal (void); static int format_user_width (uid_t u); static int format_group_width (gid_t g); static void print_long_format (const struct fileinfo *f); static void print_many_per_line (void); static size_t print_name_with_quoting (const struct fileinfo *f, bool symlink_target, struct obstack *stack, size_t start_col); static void prep_non_filename_text (void); static bool print_type_indicator (bool stat_ok, mode_t mode, enum filetype type); static void print_with_separator (char sep); static void queue_directory (char const *name, char const *realname, bool command_line_arg); static void sort_files (void); static void parse_ls_color (void); static void getenv_quoting_style (void); /* Initial size of hash table. Most hierarchies are likely to be shallower than this. */ #define INITIAL_TABLE_SIZE 30 /* The set of 'active' directories, from the current command-line argument to the level in the hierarchy at which files are being listed. A directory is represented by its device and inode numbers (struct dev_ino). A directory is added to this set when ls begins listing it or its entries, and it is removed from the set just after ls has finished processing it. This set is used solely to detect loops, e.g., with mkdir loop; cd loop; ln -s ../loop sub; ls -RL */ static Hash_table *active_dir_set; #define LOOP_DETECT (!!active_dir_set) /* The table of files in the current directory: 'cwd_file' points to a vector of 'struct fileinfo', one per file. 'cwd_n_alloc' is the number of elements space has been allocated for. 'cwd_n_used' is the number actually in use. */ /* Address of block containing the files that are described. */ static struct fileinfo *cwd_file; /* Length of block that 'cwd_file' points to, measured in files. */ static size_t cwd_n_alloc; /* Index of first unused slot in 'cwd_file'. */ static size_t cwd_n_used; /* Whether files needs may need padding due to quoting. */ static bool cwd_some_quoted; /* Whether quoting style _may_ add outer quotes, and whether aligning those is useful. */ static bool align_variable_outer_quotes; /* Vector of pointers to files, in proper sorted order, and the number of entries allocated for it. */ static void **sorted_file; static size_t sorted_file_alloc; /* When true, in a color listing, color each symlink name according to the type of file it points to. Otherwise, color them according to the 'ln' directive in LS_COLORS. Dangling (orphan) symlinks are treated specially, regardless. This is set when 'ln=target' appears in LS_COLORS. */ static bool color_symlink_as_referent; static char const *hostname; /* mode of appropriate file for colorization */ #define FILE_OR_LINK_MODE(File) \ ((color_symlink_as_referent && (File)->linkok) \ ? (File)->linkmode : (File)->stat.st_mode) /* Record of one pending directory waiting to be listed. */ struct pending { char *name; /* If the directory is actually the file pointed to by a symbolic link we were told to list, 'realname' will contain the name of the symbolic link, otherwise zero. */ char *realname; bool command_line_arg; struct pending *next; }; static struct pending *pending_dirs; /* Current time in seconds and nanoseconds since 1970, updated as needed when deciding whether a file is recent. */ static struct timespec current_time; static bool print_scontext; static char UNKNOWN_SECURITY_CONTEXT[] = "?"; /* Whether any of the files has an ACL. This affects the width of the mode column. */ static bool any_has_acl; /* The number of columns to use for columns containing inode numbers, block sizes, link counts, owners, groups, authors, major device numbers, minor device numbers, and file sizes, respectively. */ static int inode_number_width; static int block_size_width; static int nlink_width; static int scontext_width; static int owner_width; static int group_width; static int author_width; static int major_device_number_width; static int minor_device_number_width; static int file_size_width; /* Option flags */ /* long_format for lots of info, one per line. one_per_line for just names, one per line. many_per_line for just names, many per line, sorted vertically. horizontal for just names, many per line, sorted horizontally. with_commas for just names, many per line, separated by commas. -l (and other options that imply -l), -1, -C, -x and -m control this parameter. */ enum format { long_format, /* -l and other options that imply -l */ one_per_line, /* -1 */ many_per_line, /* -C */ horizontal, /* -x */ with_commas /* -m */ }; static enum format format; /* 'full-iso' uses full ISO-style dates and times. 'long-iso' uses longer ISO-style timestamps, though shorter than 'full-iso'. 'iso' uses shorter ISO-style timestamps. 'locale' uses locale-dependent timestamps. */ enum time_style { full_iso_time_style, /* --time-style=full-iso */ long_iso_time_style, /* --time-style=long-iso */ iso_time_style, /* --time-style=iso */ locale_time_style /* --time-style=locale */ }; static char const *const time_style_args[] = { "full-iso", "long-iso", "iso", "locale", NULL }; static enum time_style const time_style_types[] = { full_iso_time_style, long_iso_time_style, iso_time_style, locale_time_style }; ARGMATCH_VERIFY (time_style_args, time_style_types); /* Type of time to print or sort by. Controlled by -c and -u. The values of each item of this enum are important since they are used as indices in the sort functions array (see sort_files()). */ enum time_type { time_mtime, /* default */ time_ctime, /* -c */ time_atime, /* -u */ time_numtypes /* the number of elements of this enum */ }; static enum time_type time_type; /* The file characteristic to sort by. Controlled by -t, -S, -U, -X, -v. The values of each item of this enum are important since they are used as indices in the sort functions array (see sort_files()). */ enum sort_type { sort_none = -1, /* -U */ sort_name, /* default */ sort_extension, /* -X */ sort_size, /* -S */ sort_version, /* -v */ sort_time, /* -t */ sort_numtypes /* the number of elements of this enum */ }; static enum sort_type sort_type; /* Direction of sort. false means highest first if numeric, lowest first if alphabetic; these are the defaults. true means the opposite order in each case. -r */ static bool sort_reverse; /* True means to display owner information. -g turns this off. */ static bool print_owner = true; /* True means to display author information. */ static bool print_author; /* True means to display group information. -G and -o turn this off. */ static bool print_group = true; /* True means print the user and group id's as numbers rather than as names. -n */ static bool numeric_ids; /* True means mention the size in blocks of each file. -s */ static bool print_block_size; /* Human-readable options for output, when printing block counts. */ static int human_output_opts; /* The units to use when printing block counts. */ static uintmax_t output_block_size; /* Likewise, but for file sizes. */ static int file_human_output_opts; static uintmax_t file_output_block_size = 1; /* Follow the output with a special string. Using this format, Emacs' dired mode starts up twice as fast, and can handle all strange characters in file names. */ static bool dired; /* 'none' means don't mention the type of files. 'slash' means mention directories only, with a '/'. 'file_type' means mention file types. 'classify' means mention file types and mark executables. Controlled by -F, -p, and --indicator-style. */ enum indicator_style { none, /* --indicator-style=none */ slash, /* -p, --indicator-style=slash */ file_type, /* --indicator-style=file-type */ classify /* -F, --indicator-style=classify */ }; static enum indicator_style indicator_style; /* Names of indicator styles. */ static char const *const indicator_style_args[] = { "none", "slash", "file-type", "classify", NULL }; static enum indicator_style const indicator_style_types[] = { none, slash, file_type, classify }; ARGMATCH_VERIFY (indicator_style_args, indicator_style_types); /* True means use colors to mark types. Also define the different colors as well as the stuff for the LS_COLORS environment variable. The LS_COLORS variable is now in a termcap-like format. */ static bool print_with_color; static bool print_hyperlink; /* Whether we used any colors in the output so far. If so, we will need to restore the default color later. If not, we will need to call prep_non_filename_text before using color for the first time. */ static bool used_color = false; enum when_type { when_never, /* 0: default or --color=never */ when_always, /* 1: --color=always */ when_if_tty /* 2: --color=tty */ }; enum Dereference_symlink { DEREF_UNDEFINED = 1, DEREF_NEVER, DEREF_COMMAND_LINE_ARGUMENTS, /* -H */ DEREF_COMMAND_LINE_SYMLINK_TO_DIR, /* the default, in certain cases */ DEREF_ALWAYS /* -L */ }; enum indicator_no { C_LEFT, C_RIGHT, C_END, C_RESET, C_NORM, C_FILE, C_DIR, C_LINK, C_FIFO, C_SOCK, C_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR, C_SETUID, C_SETGID, C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE, C_CAP, C_MULTIHARDLINK, C_CLR_TO_EOL }; static const char *const indicator_name[]= { "lc", "rc", "ec", "rs", "no", "fi", "di", "ln", "pi", "so", "bd", "cd", "mi", "or", "ex", "do", "su", "sg", "st", "ow", "tw", "ca", "mh", "cl", NULL }; struct color_ext_type { struct bin_str ext; /* The extension we're looking for */ struct bin_str seq; /* The sequence to output when we do */ struct color_ext_type *next; /* Next in list */ }; static struct bin_str color_indicator[] = { { LEN_STR_PAIR ("\033[") }, /* lc: Left of color sequence */ { LEN_STR_PAIR ("m") }, /* rc: Right of color sequence */ { 0, NULL }, /* ec: End color (replaces lc+rs+rc) */ { LEN_STR_PAIR ("0") }, /* rs: Reset to ordinary colors */ { 0, NULL }, /* no: Normal */ { 0, NULL }, /* fi: File: default */ { LEN_STR_PAIR ("01;34") }, /* di: Directory: bright blue */ { LEN_STR_PAIR ("01;36") }, /* ln: Symlink: bright cyan */ { LEN_STR_PAIR ("33") }, /* pi: Pipe: yellow/brown */ { LEN_STR_PAIR ("01;35") }, /* so: Socket: bright magenta */ { LEN_STR_PAIR ("01;33") }, /* bd: Block device: bright yellow */ { LEN_STR_PAIR ("01;33") }, /* cd: Char device: bright yellow */ { 0

相關推薦

Linux ls命令是如何快速得到資料大小

先給自己挖個坑,後面慢慢填 在ls的原始碼中,通過下面的程式碼得到檔案的塊數,但是沒有找到ST_NBLOCKS是什麼東西 blocks = ST_NBLOCKS (f->stat); 然後就發現,原來ls得到的目錄大小是假的,這這是目錄這個檔案佔用的磁碟大小,

Linux下檢視檔案和資料大小的df和du命令聯絡與區別

前面經常需要對Host裡的多個VM進行一些操作如take snapshot等,需要檢視容量時經常用到df -h,但是用到du  的比較少,當需要檢視具體的某個資料夾下的各個檔案 的大小時就需要用到du , 看了下面的介紹當使用 du -h --max-depth=1 wor

linux檢視根目錄下所有資料大小

linux檢視根目錄下所有資料夾大小的方法如下: 1、進入根目錄:cd / 2、使用命令 : du -sh * 檢視根目錄下每個資料夾的大小 3、進入佔用空間比較大的資料夾,然後再使用2中命令查詢大檔案。   查詢大於10M的檔案 find / -type f -size +

Linux下檢視檔案和資料大小

zt:http://www.cnblogs.com/benio/archive/2010/10/13/1849946.html 當磁碟大小超過標準時會有報警提示,這時如果掌握df和du命令是非常明智的選擇。     df可以檢視一級資料夾大小、使用比例、檔案系統及其

Linux下檢視檔案和資料大小(df&du)

df 用法:df [選項]… [檔案]… 顯示每個檔案所在的檔案系統的資訊,預設顯示全部的檔案系統 常用選項 -h, –human-readable 大小顯示為人類易讀形式 (e.g., 1K

Linux下檢視檔案和資料大小--df,du

當磁碟大小超過標準時會有報警提示,這時如果掌握df和du命令是非常明智的選擇。    df可以檢視一級資料夾大小、使用比例、檔案系統及其掛入點,但對檔案卻無能為力。    du可以檢視檔案及資料夾的大小。    兩者配合使用,非常有效。比如用df檢視哪個一級目錄過大,然後用d

wind doc命令快速開啟資料

通過 cmd 命令列進入指定目錄後如果想檢視該目錄下的檔案需要輸入 dir 命令,很不方便,我們可以在 cmd 下開啟資料夾圖形介面: explorer path 例子: 1、開啟當前目錄 ex

linux檢視當前檔案和資料大小

Linux檢視檔案和資料夾大小 1、du -sh 檢視當前資料夾大小 du -sh * | sort -n 統計當前資料夾(目錄)大小,並按檔案大小排序 附送:du -sk filename 檢視指定檔案大小 2、 Linux:ls以K、M、G為單位檢視檔案大小 #ls

如何用dos命令快速獲得資料下的檔名列表

因為要寫一個paper,耿工需要獲得指定資料夾下的檔名列表,於是便產生了如下的操作技巧 cmd cd進入到指定資料夾下 dir /b >1.txt 或者 dir /b >1.xls 如果你安裝了office 可以自由地使用該命令將資料匯入到office文件當中,

[Linux]Linux下檢視檔案和資料大小-檢視容量-檢視資料碟符容量

鋒影 email:[email protected] 如果你認為本系列文章對你有所幫助,請大家有錢的捧個錢場,點選此處贊助,贊助額0.1元起步,多少隨意 當磁碟大小超過標準時會有報警提示,這時如果掌握df和du命令是非常明智的選擇。     df可以檢視一級

Linux下用ls和du命令檢視檔案以及資料大小 (轉載)

ls的用法 ls -l |grep "^-"|wc -l或find ./company -type f | wc -l  檢視某資料夾下檔案的個數,包括子資料夾裡的。 ls -lR|grep "^-"|wc -l   檢視某資料夾下資料夾的個數,包括子資料夾裡的

Linux下用ls和du命令檢視檔案以及資料大小

ls -l |grep "^-"|wc -l或find ./company -type f | wc -l  檢視某資料夾下檔案的個數,包括子資料夾裡的。 ls -lR|grep "^-"|wc -l   檢視某資料夾下資料夾的個數,包括子資料夾裡的。 ls -lR|grep "^d"|wc -l  說明:

Linux下檢視檔案和資料佔用記憶體大小、刪除日誌 命令

轉:https://www.cnblogs.com/lixuwu/p/5944062.html 閱讀目錄 1 Linux下檢視檔案和資料夾大小 2 刪除系統日誌等 3 實踐 場景:在sts中執行自動部署時候maven提示No space left on d

Linux中檢視各資料大小命令du -h --max-depth=1

du [-abcDhHklmsSx] [-L <符號連線>][-X <檔案>][--block-size][--exclude=<目錄或檔案>] [--max-depth=<目錄層數>][--help][--

linux 檢視資料大小命令

很早之前遇到一個samba的問題。可以正常啟動,但是無法上傳檔案,本來是正常的。後來排查到最後,發現是磁碟滿了。於是整理了幾個檢視磁碟空間的命令,一直忘記整理了。記錄在這裡 1、df -lh  檢視磁碟大小 2、du -s /usr/* | sort -rn   檢視 /

linux 檢視資料大小命令(du)

命令du [option]....[option] [file] 引數: -h 以gb mb 等常用單位顯示大小--max-depth=[number] 設定搜尋深度 示例: du -h du  -

Linux 查看各文件大小命令du -h --max-depth=1

參數 開始 文件系統 from ren args abc use 使用情況 du [-abcDhHklmsSx] [-L <符號連接>][-X <文件>][--block-size][--exclude=<目錄或文件>] [--max-d

linux檢視檔案和資料大小方法

檢視磁碟的佔用情況: $ sudo df -h udev 3.8G 0 3.8G 0% /dev tmpfs 771M 9.4M 762M 2% /run /dev/sda9 57G 5.1G 49

Linux命令之建立資料3

1)mkdir  fyr即可在當前目錄下建立一個資料夾 2)在fyr資料夾下建立一個子目錄 mkdir fyr/fyr1 注意:如果不存在父層目錄直接建立對應父層目錄下的子目錄mkdir  FYR/fyr2 ;如圖所示會提示失敗; 解決同時建立父層面和對應子目錄的,加引數mkdi

linux檢視資料大小

  du:查詢檔案或資料夾的磁碟使用空間     如果當前目錄下檔案和資料夾很多,使用不帶引數du的命令,可以迴圈列出所有檔案和資料夾所使用的空間。這對檢視究竟是那個地方過大是不利的,所以得指定 深入目錄的層數,引數:--max-depth=,這是個極為有用的引數!如下