This patch adds an option to du to have it print the number of inodes in use by a tree. --- coreutils-5.2.1.orig/src/du.c 2005-02-20 23:49:43.768236000 +0100 +++ coreutils-5.2.1/src/du.c 2005-02-21 01:16:52.831298552 +0100 @@ -121,6 +121,10 @@ static struct exclude *exclude; /* Grand total size of all args, in bytes. */ static uintmax_t tot_size = 0; +/* Print the amount of inodes used. */ +static int print_inodes = 0; +static unsigned int inodes = 0; + /* Nonzero indicates that du should exit with EXIT_FAILURE upon completion. */ int G_fail; @@ -165,6 +169,7 @@ static struct option const long_options[ {"separate-dirs", no_argument, NULL, 'S'}, {"summarize", no_argument, NULL, 's'}, {"total", no_argument, NULL, 'c'}, + {"inodes", no_argument, NULL, 'i'}, #ifdef HAVE_LIBVSERVER {"xid", required_argument, NULL, 'C'}, #endif @@ -407,6 +412,7 @@ process_file (FTS *fts, FTSENT *ent) size = (apparent_size ? sb->st_size : ST_NBLOCKS (*sb) * ST_NBLOCKSIZE); + inodes++; } if (first_call) @@ -549,6 +555,9 @@ du_files (char **files, int bit_flags) if (print_totals) print_size (tot_size, _("total")); + if (print_inodes) + printf("%-7d %s\n", inodes, _("inodes")); + return fail; } @@ -584,7 +593,7 @@ main (int argc, char **argv) &output_block_size); fail = 0; - while ((c = getopt_long (argc, argv, DEBUG_OPT "0abchHklmsxB:DLPSX:", + while ((c = getopt_long (argc, argv, DEBUG_OPT "0abchHklmsxB:DLPSX:i", long_options, NULL)) != -1) { long int tmp_long; @@ -705,6 +714,10 @@ main (int argc, char **argv) add_exclude (exclude, optarg, EXCLUDE_WILDCARDS); break; + case 'i': + print_inodes = 1; + break; + #ifdef HAVE_LIBVSERVER case 'C': {