diff options
author | Jakob Truelsen <jakob@scalgo.com> | 2013-01-21 06:29:12 +0100 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2013-01-21 11:38:54 +0100 |
commit | f8afbb424c050578617bc9ddf4ccf69ed2bdb953 (patch) | |
tree | 5b1f5b44bcb916aa69eb3f731b5736ca037751b5 /doc/coreutils.texi | |
parent | 40b2770a22828e347c9ff0640f4ee0702319e8e7 (diff) | |
download | coreutils-f8afbb424c050578617bc9ddf4ccf69ed2bdb953.tar.xz |
du: add -t SIZE, --threshold=SIZE option
* src/du.c (opt_threshold): Add variable to hold the value of
the --threshold option specified by the user.
(long_options): Add a required_argument entry for the new
--threshold option.
(usage): Add --threshold option.
(process_file): Elide printing the entry if its size does not
meet the value specified by the --threshold option.
(main): In the argument parsing loop, add a case for the new
-t option. Convert the given argument by permitting the
well-known suffixes for megabyte, gigabytes, etc.
Handle the special case "-0": give an error as this value is
not permitted.
* doc/coreutils.texi (du invocation): Add documentation for the
above new option.
* tests/du/threshold.sh: Add new test to exercise the new option.
* tests/local.mk (all_tests): Mention the above test.
Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
Diffstat (limited to 'doc/coreutils.texi')
-rw-r--r-- | doc/coreutils.texi | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 45a4b3d16..8d7eff764 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -11022,6 +11022,41 @@ With @option{--separate-dirs}, the size reported for a directory name, @var{d}, is merely the @code{stat.st_size}-derived size of the directory entry, @var{d}. +@item -t @var{size} +@item --threshold=@var{size} +@opindex -t +@opindex --threshold +Exclude entries based on a given @var{size} (@pxref{Block size}). + +If @var{size} is positive, then @command{du} will only print entries with a size +greater than or equal to that. + +If @var{size} is negative, then @command{du} will only print entries with a size +smaller than or equal to that. + +Although GNU @command{find} can be used to find files of a certain size, +@command{du}'s @option{--threshold} option can be used to also filter +directories based on a given size. + +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. + +Here's how you would use @option{--threshold} to find directories with a size +greater than or equal to 200 megabytes: + +@example +du --threshold=200MB +@end example + +Here's how you would use @option{--threshold} to find directories and files - +note the @option{-a} - with an apparent size smaller than or equal to 500 bytes: + +@example +du -a -t -500 --apparent-size +@end example + + @item --time @opindex --time @cindex last modified dates, displaying in @command{du} |