summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2013-07-27 14:25:28 +0200
committerBernhard Voelker <mail@bernhard-voelker.de>2013-07-27 14:25:28 +0200
commit333dc83d52e014a0b532e316ea8cd93b048f1ac6 (patch)
tree3bf519653280e660e7311e436b6e0e0fee8160a5 /doc
parent2bdb74ec1a453f6c6084d042e573de436ec205f3 (diff)
downloadcoreutils-333dc83d52e014a0b532e316ea8cd93b048f1ac6.tar.xz
du: add --inodes option
This new option can be used to find directories with a huge amount of files. The GNU find utility has the printf format "%h" which prints the number of entries in a directory, but this is non-cumulative and doesn't handle hard links. * src/du.c (struct duinfo): Add new member for counting inodes. (duinfo_init): Initialize inodes member with Zero. (duinfo_set): Set inodes counter to 1. (duinfo_add): Sum up the 2 given inodes counters. (opt_inodes): Add new boolean flag to remember if the --inodes option has been specified. (INODES_OPTION): Add new enum value to be used ... (long_options): ... here. (usage): Add description of the new option. (print_size): Pass inodes counter or size to print_only_size, depending on the inodes mode. (process_file): Adapt threshold handling: with --inodes, print or elide the entries according to the struct member inodes. (main): Add a case for accepting the new INODES_OPTION. Print a warning diagnostic when --inodes is used together with the option --apparent-size or -b. Reset the output_block_size to 1 ... and thus ignoring the options -m and -k. * tests/du/inodes.sh: Add a new test. * tests/local.mk (all_tests): Mention it. * doc/coreutils.texi (du invocation): Document the new option. * NEWS: Mention the new option.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi27
1 files changed, 26 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index b8d40b4f5..40bff7ae9 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -11424,6 +11424,18 @@ Equivalent to @option{--dereference-args} (@option{-D}).
@optHumanReadable
+@itemx --inodes
+@opindex --inodes
+@cindex inode usage, dereferencing in @command{du}
+List inode usage information instead of block usage.
+This option is useful for finding directories which contain many files, and
+therefore eat up most of the inodes space of a file system (see @command{df},
+option @option{--inodes}).
+It can well be combined with the options @option{-a}, @option{-c},
+@option{-h}, @option{-l}, @option{-s}, @option{-S}, @option{-t} and
+@option{-x}; however, passing other options regarding the block size, for
+example @option{-b}, @option{-m} and @option{--apparent-size}, is ignored.
+
@item -k
@opindex -k
@cindex kibibytes for file sizes
@@ -11485,7 +11497,9 @@ Display only a total for each argument.
@itemx --threshold=@var{size}
@opindex -t
@opindex --threshold
-Exclude entries based on a given @var{size} (@pxref{Block size}).
+Exclude entries based on a given @var{size}. The @var{size} refers to used
+blocks in normal mode (@pxref{Block size}), or inodes count in conjunction
+with the @option{--inodes} option.
If @var{size} is positive, then @command{du} will only print entries with a size
greater than or equal to that.
@@ -11501,6 +11515,10 @@ Please note that the @option{--threshold} option can be combined with the
@option{--apparent-size} option, and in this case would elide entries based on
its apparent size.
+Please note that the @option{--threshold} option can be combined with the
+@option{--inodes} option, and in this case would elide entries based on
+its inodes count.
+
Here's how you would use @option{--threshold} to find directories with a size
greater than or equal to 200 megabytes:
@@ -11515,6 +11533,13 @@ note the @option{-a} - with an apparent size smaller than or equal to 500 bytes:
du -a -t -500 --apparent-size
@end example
+Here's how you would use @option{--threshold} to find directories on the root
+file system with more than 20000 inodes used in the directory tree below:
+
+@example
+du --inodes -x --threshold=20000 /
+@end example
+
@item --time
@opindex --time