| Summary: | [patch] du(1) man page improvements | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Documentation | Reporter: | Alexander Best <arundel> | ||||||||
| Component: | Books & Articles | Assignee: | Glen Barber <gjb> | ||||||||
| Status: | Closed FIXED | ||||||||||
| Severity: | Affects Only Me | ||||||||||
| Priority: | Normal | ||||||||||
| Version: | Latest | ||||||||||
| Hardware: | Any | ||||||||||
| OS: | Any | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Alexander Best
2011-11-10 14:30:07 UTC
On Thu, 10 Nov 2011, Alexander Best wrote: > > > diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1 > index ef8b5ac..960be23 100644 > --- a/usr.bin/du/du.1 > +++ b/usr.bin/du/du.1 > @@ -28,7 +28,7 @@ > .\" @(#)du.1 8.2 (Berkeley) 4/1/94 > .\" $FreeBSD$ > .\" > -.Dd November 6, 2008 > +.Dd November 10, 2011 > .Dt DU 1 > .Os > .Sh NAME > @@ -36,15 +36,12 @@ > .Nd display disk usage statistics > .Sh SYNOPSIS > .Nm > -.Op Fl A > +.Op Fl Achklmnx > .Op Fl H | L | P > -.Op Fl a | s | d Ar depth | Fl t Ar threshold > -.Op Fl c > -.Op Fl l > -.Op Fl h | k | m | B Ar blocksize > -.Op Fl n > -.Op Fl x > +.Op Fl a | s | d Ar depth > +.Op Fl B Ar blocksize > .Op Fl I Ar mask > +.Op Fl t Ar threshold > .Op Ar > .Sh DESCRIPTION > The > @@ -61,11 +58,13 @@ The options are as follows: > Display the apparent size instead of the disk usage. > This can be helpful when operating on compressed volumes or sparse files. > .It Fl B Ar blocksize > -Calculate block counts in > +Calculate block count in I think this is incorrect. Block counts are computed for all path arguments given to du(1). (Even if it was just "block count", it would need to be "the block count".) > .Ar blocksize > byte blocks. > This is different from the > -.Fl k, m > +.Fl h, k > +and > +.Fl m > options or setting > .Ev BLOCKSIZE > and gives an estimate of how much space the examined file hierarchy would > @@ -79,20 +78,45 @@ is rounded up to the next multiple of 512. > .It Fl H > Symbolic links on the command line are followed, symbolic links in file > hierarchies are not followed. > -.It Fl L > -Symbolic links on the command line and in file hierarchies are followed. > .It Fl I Ar mask > Ignore files and directories matching the specified > .Ar mask . > +.It Fl L > +Symbolic links on the command line and in file hierarchies are followed. > .It Fl P > No symbolic links are followed. > This is the default. > .It Fl a > Display an entry for each file in a file hierarchy. > +.It Fl c > +Display a grand total. > +.It Fl d Ar depth > +Display an entry for all files and directories > +.Ar depth > +directories deep. > .It Fl h > "Human-readable" output. > Use unit suffixes: Byte, Kilobyte, Megabyte, > Gigabyte, Terabyte and Petabyte. > +.It Fl k > +Display block count in 1024-byte (1-Kbyte) blocks. Likewise here. > +.It Fl l > +If a file has multiple hard links, count its size many times. I would probably s/many/multiple/ to make the parallelism clear. > +The default behavior of > +.Nm > +is to count files with multiple hard links only once. > +When the > +.Fl l > +option is specified, the hard link checks are disabled, and these files > +are counted (and displayed) as many times as they are found. Could use .Pq, I suppose. > +.It Fl m > +Display block count in 1048576-byte (1-Mbyte) blocks. block counts, again. (and .Pq) (Is moving a block of text around in the same commit as changing it actually a good idea?) > +.It Fl n > +Ignore files and directories with user > +.Dq nodump > +flag > +.Pq Dv UF_NODUMP > +set. > .It Fl r > Generate messages about directories that cannot be read, files > that cannot be opened, and so on. [the block that got moved] > @@ -152,26 +151,33 @@ If either the > .Fl H > or > .Fl L > -options are specified, storage used by any symbolic links which are > -followed is not counted or displayed. > +option is specified, storage used by any symbolic links which are > +followed is not counted (or displayed). > +.Pp > +The > +.Fl h, k > +and > +.Fl m > +options all override each other; the last one specified determines > +the block count used. > .Sh ENVIRONMENT > .Bl -tag -width BLOCKSIZE > .It Ev BLOCKSIZE > If the environment variable > .Ev BLOCKSIZE > is set, and the > -.Fl k, m > +.Fl h, k > or > -.Fl h > -options are not specified, the block counts will be displayed in units of > +.Fl m > +options are not specified, the block count will be displayed in units of counts again Thanks for spotting the style issues. -Ben Kaduk > that block size. > If > .Ev BLOCKSIZE > is not set, and the > -.Fl k, m > +.Fl h, k > or > -.Fl h > -options are not specified, the block counts will be displayed in 512-byte > +.Fl m > +options are not specified, the block count will be displayed in 512-byte > blocks. > .El > .Sh SEE ALSO > > >> Release-Note: >> Audit-Trail: >> Unformatted: > _______________________________________________ > freebsd-doc@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-doc > To unsubscribe, send any mail to "freebsd-doc-unsubscribe@freebsd.org" > On Thu Nov 10 11, Benjamin Kaduk wrote: > On Thu, 10 Nov 2011, Alexander Best wrote: > > >> > > >diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1 > >index ef8b5ac..960be23 100644 > >--- a/usr.bin/du/du.1 > >+++ b/usr.bin/du/du.1 > >@@ -28,7 +28,7 @@ > >.\" @(#)du.1 8.2 (Berkeley) 4/1/94 > >.\" $FreeBSD$ > >.\" > >-.Dd November 6, 2008 > >+.Dd November 10, 2011 > >.Dt DU 1 > >.Os > >.Sh NAME > >@@ -36,15 +36,12 @@ > >.Nd display disk usage statistics > >.Sh SYNOPSIS > >.Nm > >-.Op Fl A > >+.Op Fl Achklmnx > >.Op Fl H | L | P > >-.Op Fl a | s | d Ar depth | Fl t Ar threshold > >-.Op Fl c > >-.Op Fl l > >-.Op Fl h | k | m | B Ar blocksize > >-.Op Fl n > >-.Op Fl x > >+.Op Fl a | s | d Ar depth > >+.Op Fl B Ar blocksize > >.Op Fl I Ar mask > >+.Op Fl t Ar threshold > >.Op Ar > >.Sh DESCRIPTION > >The > >@@ -61,11 +58,13 @@ The options are as follows: > >Display the apparent size instead of the disk usage. > >This can be helpful when operating on compressed volumes or sparse files. > >.It Fl B Ar blocksize > >-Calculate block counts in > >+Calculate block count in > > I think this is incorrect. Block counts are computed for all path > arguments given to du(1). (Even if it was just "block count", it would > need to be "the block count".) > > >.Ar blocksize > >byte blocks. > >This is different from the > >-.Fl k, m > >+.Fl h, k > >+and > >+.Fl m > >options or setting > >.Ev BLOCKSIZE > >and gives an estimate of how much space the examined file hierarchy would > >@@ -79,20 +78,45 @@ is rounded up to the next multiple of 512. > >.It Fl H > >Symbolic links on the command line are followed, symbolic links in file > >hierarchies are not followed. > >-.It Fl L > >-Symbolic links on the command line and in file hierarchies are followed. > >.It Fl I Ar mask > >Ignore files and directories matching the specified > >.Ar mask . > >+.It Fl L > >+Symbolic links on the command line and in file hierarchies are followed. > >.It Fl P > >No symbolic links are followed. > >This is the default. > >.It Fl a > >Display an entry for each file in a file hierarchy. > >+.It Fl c > >+Display a grand total. > >+.It Fl d Ar depth > >+Display an entry for all files and directories > >+.Ar depth > >+directories deep. > >.It Fl h > >"Human-readable" output. > >Use unit suffixes: Byte, Kilobyte, Megabyte, > >Gigabyte, Terabyte and Petabyte. > >+.It Fl k > >+Display block count in 1024-byte (1-Kbyte) blocks. > > Likewise here. > > >+.It Fl l > >+If a file has multiple hard links, count its size many times. > > I would probably s/many/multiple/ to make the parallelism clear. > > >+The default behavior of > >+.Nm > >+is to count files with multiple hard links only once. > >+When the > >+.Fl l > >+option is specified, the hard link checks are disabled, and these files > >+are counted (and displayed) as many times as they are found. > > Could use .Pq, I suppose. > > >+.It Fl m > >+Display block count in 1048576-byte (1-Mbyte) blocks. > > block counts, again. > (and .Pq) > > (Is moving a block of text around in the same commit as changing it > actually a good idea?) > > >+.It Fl n > >+Ignore files and directories with user > >+.Dq nodump > >+flag > >+.Pq Dv UF_NODUMP > >+set. > >.It Fl r > >Generate messages about directories that cannot be read, files > >that cannot be opened, and so on. > [the block that got moved] > >@@ -152,26 +151,33 @@ If either the > >.Fl H > >or > >.Fl L > >-options are specified, storage used by any symbolic links which are > >-followed is not counted or displayed. > >+option is specified, storage used by any symbolic links which are > >+followed is not counted (or displayed). > >+.Pp > >+The > >+.Fl h, k > >+and > >+.Fl m > >+options all override each other; the last one specified determines > >+the block count used. > >.Sh ENVIRONMENT > >.Bl -tag -width BLOCKSIZE > >.It Ev BLOCKSIZE > >If the environment variable > >.Ev BLOCKSIZE > >is set, and the > >-.Fl k, m > >+.Fl h, k > >or > >-.Fl h > >-options are not specified, the block counts will be displayed in units of > >+.Fl m > >+options are not specified, the block count will be displayed in units of > > counts again > > > Thanks for spotting the style issues. thanks for looking at my patch. i'll try to fix all those issues you mentioned and will submit a followup patch. cheers. alex > > -Ben Kaduk > > > >that block size. > >If > >.Ev BLOCKSIZE > >is not set, and the > >-.Fl k, m > >+.Fl h, k > >or > >-.Fl h > >-options are not specified, the block counts will be displayed in 512-byte > >+.Fl m > >+options are not specified, the block count will be displayed in 512-byte > >blocks. > >.El > >.Sh SEE ALSO > > > > > >>Release-Note: > >>Audit-Trail: > >>Unformatted: > >_______________________________________________ > >freebsd-doc@freebsd.org mailing list > >http://lists.freebsd.org/mailman/listinfo/freebsd-doc > >To unsubscribe, send any mail to "freebsd-doc-unsubscribe@freebsd.org" > > here's an updated version of the patch. could you check, if i missed anything?
i didn't include .Pq macros, since i find "(" and ")" much easier to handle and
believe macros should only be used in places, where it's really necessary to do
so.
cheers.
alex
On Thu, 10 Nov 2011, Alexander Best wrote: > here's an updated version of the patch. could you check, if i missed anything? > > i didn't include .Pq macros, since i find "(" and ")" much easier to > handle and believe macros should only be used in places, where it's > really necessary to do so. That's fair. I think there is reason to prefer .Dq to literal '"', though, which I missed the first time around -- it uses "pretty" quotes, i.e. .Dq text becomes ``text'' > diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1 > index ef8b5ac..3846f6b 100644 > --- a/usr.bin/du/du.1 > +++ b/usr.bin/du/du.1 > @@ -79,48 +78,30 @@ is rounded up to the next multiple of 512. > .It Fl H > Symbolic links on the command line are followed, symbolic links in file > hierarchies are not followed. > -.It Fl L > -Symbolic links on the command line and in file hierarchies are followed. > .It Fl I Ar mask > Ignore files and directories matching the specified > .Ar mask . > +.It Fl L > +Symbolic links on the command line and in file hierarchies are followed. > .It Fl P > No symbolic links are followed. > This is the default. > .It Fl a > Display an entry for each file in a file hierarchy. > -.It Fl h > -"Human-readable" output. > -Use unit suffixes: Byte, Kilobyte, Megabyte, > -Gigabyte, Terabyte and Petabyte. > -.It Fl r > -Generate messages about directories that cannot be read, files > -that cannot be opened, and so on. > -This is the default case. > -This option exists solely for conformance with > -.St -xpg4 . > -.It Fl s > -Display an entry for each specified file. > -(Equivalent to > -.Fl d Li 0 ) > -.It Fl t Ar threshold > -Display only entries for which size exceeds > -.Ar threshold . > -If > -.Ar threshold > -is negative, display only entries for which size is less than the absolute > -value of > -.Ar threshold . > +.It Fl c > +Display a grand total. > .It Fl d Ar depth > Display an entry for all files and directories > .Ar depth > directories deep. > -.It Fl c > -Display a grand total. > +.It Fl h > +"Human-readable" output. So this would become: .Dq Human-readable output. (Just stuff you reordered, I know, but while we're here ...) -Ben > +Use unit suffixes: Byte, Kilobyte, Megabyte, > +Gigabyte, Terabyte and Petabyte. > .It Fl k > Display block counts in 1024-byte (1-Kbyte) blocks. > .It Fl l > -If a file has multiple hard links, count its size many times. > +If a file has multiple hard links, count its size multiple times. > The default behavior of > .Nm > is to count files with multiple hard links only once. here's another revised version of my patch. this now also includes changes to du.c:usage() to reflect the man page changes. cheers. alex On Fri, 11 Nov 2011, Alexander Best wrote:
> here's another revised version of my patch. this now also includes changes
> to du.c:usage() to reflect the man page changes.
Looks okay to me -- thanks.
-Ben
On Fri Nov 11 11, Benjamin Kaduk wrote: > On Fri, 11 Nov 2011, Alexander Best wrote: > > >here's another revised version of my patch. this now also includes changes > >to du.c:usage() to reflect the man page changes. > > Looks okay to me -- thanks. good to hear. now we need somebody to commit this. ;) > > -Ben Responsible Changed From-To: freebsd-doc->gjb I'll take this. Author: gjb (doc committer) Date: Fri Dec 9 02:30:56 2011 New Revision: 228356 URL: http://svn.freebsd.org/changeset/base/228356 Log: Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis [1] - Other miscellaneous improvements PR: 162438 Submitted by: arundel Reviewed by: Benjamin Kaduk (kaduk ! mit.edu), jhb[1] (original version) MFC after: 1 week Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Thu Dec 8 23:58:26 2011 (r228355) +++ head/usr.bin/du/du.1 Fri Dec 9 02:30:56 2011 (r228356) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -36,15 +36,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -65,7 +63,9 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -79,48 +79,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -136,6 +119,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -152,25 +153,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Thu Dec 8 23:58:26 2011 (r228355) +++ head/usr.bin/du/du.c Fri Dec 9 02:30:56 2011 (r228356) @@ -499,9 +499,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: open->patched Patched in head (r228356) pending MFC. Author: gjb (doc committer) Date: Mon Jan 2 23:43:16 2012 New Revision: 229340 URL: http://svn.freebsd.org/changeset/base/229340 Log: MFC r228356: r228356: - Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis - Other miscellaneous improvements PR: 162438 Modified: stable/9/usr.bin/du/du.1 stable/9/usr.bin/du/du.c Directory Properties: stable/9/usr.bin/du/ (props changed) Modified: stable/9/usr.bin/du/du.1 ============================================================================== --- stable/9/usr.bin/du/du.1 Mon Jan 2 23:43:08 2012 (r229339) +++ stable/9/usr.bin/du/du.1 Mon Jan 2 23:43:16 2012 (r229340) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -36,15 +36,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -65,7 +63,9 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -79,48 +79,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -136,6 +119,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -152,25 +153,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: stable/9/usr.bin/du/du.c ============================================================================== --- stable/9/usr.bin/du/du.c Mon Jan 2 23:43:08 2012 (r229339) +++ stable/9/usr.bin/du/du.c Mon Jan 2 23:43:16 2012 (r229340) @@ -507,9 +507,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: gjb (doc committer) Date: Mon Jan 2 23:44:07 2012 New Revision: 229343 URL: http://svn.freebsd.org/changeset/base/229343 Log: MFC r210993, r228356: r210933 (joel): - Fix typos and spelling mistakes r228356: [3] - Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis - Other miscellaneous improvements PR: 162438 [3] Modified: stable/8/usr.bin/du/du.1 stable/8/usr.bin/du/du.c Directory Properties: stable/8/usr.bin/du/ (props changed) Modified: stable/8/usr.bin/du/du.1 ============================================================================== --- stable/8/usr.bin/du/du.1 Mon Jan 2 23:43:45 2012 (r229342) +++ stable/8/usr.bin/du/du.1 Mon Jan 2 23:44:07 2012 (r229343) @@ -32,7 +32,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -40,15 +40,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -69,10 +67,12 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE -and gives an estimate of how much space the examined file hierachy would +and gives an estimate of how much space the examined file hierarchy would require on a filesystem with the given .Ar blocksize . Unless in @@ -83,48 +83,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -140,6 +123,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -156,25 +157,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: stable/8/usr.bin/du/du.c ============================================================================== --- stable/8/usr.bin/du/du.c Mon Jan 2 23:43:45 2012 (r229342) +++ stable/8/usr.bin/du/du.c Mon Jan 2 23:44:07 2012 (r229343) @@ -511,9 +511,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: patched->closed MFC'd to stable/9 and stable/8. MFC to stable/7 is still pending. Author: gjb (doc committer) Date: Sat Jan 7 01:39:38 2012 New Revision: 229756 URL: http://svn.freebsd.org/changeset/base/229756 Log: MFC r209362, r210933, r228356: r209362 (brian) [1]: - Add a -t switch for masking output that's above or below certain thresholds. This switch makes it a lot easier to locate problem areas when a process is threatening to consume all of your disk space. r210933 (joel): - Fix typos and spelling mistakes. r228356 [2]: - Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis - Other miscellaneous improvements Approved by: brian [1] PR: 162438 [2] Modified: stable/7/usr.bin/du/du.1 stable/7/usr.bin/du/du.c Directory Properties: stable/7/usr.bin/du/ (props changed) Modified: stable/7/usr.bin/du/du.1 ============================================================================== --- stable/7/usr.bin/du/du.1 Sat Jan 7 01:12:21 2012 (r229755) +++ stable/7/usr.bin/du/du.1 Sat Jan 7 01:39:38 2012 (r229756) @@ -32,7 +32,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -40,15 +40,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P +.Op Fl h | k | m .Op Fl a | s | d Ar depth -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -69,10 +67,12 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE -and gives an estimate of how much space the examined file hierachy would +and gives an estimate of how much space the examined file hierarchy would require on a filesystem with the given .Ar blocksize . Unless in @@ -83,40 +83,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -132,6 +123,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -148,25 +157,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: stable/7/usr.bin/du/du.c ============================================================================== --- stable/7/usr.bin/du/du.c Sat Jan 7 01:12:21 2012 (r229755) +++ stable/7/usr.bin/du/du.c Sat Jan 7 01:39:38 2012 (r229756) @@ -88,6 +88,7 @@ main(int argc, char *argv[]) FTS *fts; FTSENT *p; off_t savednumber, curblocks; + off_t threshold, threshold_sign; int ftsoptions; int listall; int depth; @@ -104,12 +105,14 @@ main(int argc, char *argv[]) save = argv; ftsoptions = 0; savednumber = 0; + threshold = 0; + threshold_sign = 1; cblocksize = DEV_BSIZE; blocksize = 0; depth = INT_MAX; SLIST_INIT(&ignores); - while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrx")) != -1) + while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrt:x")) != -1) switch (ch) { case 'A': Aflag = 1; @@ -177,6 +180,14 @@ main(int argc, char *argv[]) break; case 'r': /* Compatibility. */ break; + case 't' : + if (expand_number(optarg, &threshold) != 0 || + threshold == 0) { + warnx("invalid threshold: %s", optarg); + usage(); + } else if (threshold < 0) + threshold_sign = -1; + break; case 'x': ftsoptions |= FTS_XDEV; break; @@ -246,6 +257,10 @@ main(int argc, char *argv[]) blocksize /= DEV_BSIZE; } + if (threshold != 0) + threshold = howmany(threshold / DEV_BSIZE * cblocksize, + blocksize); + rval = 0; if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL) @@ -267,7 +282,9 @@ main(int argc, char *argv[]) p->fts_parent->fts_bignum += p->fts_bignum += curblocks; - if (p->fts_level <= depth) { + if (p->fts_level <= depth && threshold <= + threshold_sign * howmany(p->fts_bignum * + cblocksize, blocksize)) { if (hflag) { prthumanval(p->fts_bignum); (void)printf("\t%s\n", p->fts_path); @@ -486,9 +503,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" |