On Wed, Jan 29, 2020 at 05:48:44PM +0100, Ingo Schwarze wrote: > Hi Jason, > > Jason McIntyre wrote on Wed, Jan 29, 2020 at 04:26:42PM +0000: > > > i don;t think it would be such a bad thing for du to have an example or > > two, so i'm ok with this. > > > > so sth like: > > > > Display a summary of files and folders in the current directory, > > sorted by size: > > > > $ blah > > That wording seems very nice to me, see below for a patch. > > I also included .??* because having large hidden directories around > and desperately searching for the waste of disk space elsewhere > seems like a common trap to me. > > > - i guess if you have a lot of stuff it makes sense to have the biggest > > files displayed at the end of the list. but generally wouldn;t you > > want your biggest files listed first? we could add -r to sort. > > Actually, i consider it more versatile without the -r. > You are right, it really matters for directories with lots of entries. > But even with few entries, what's wrong with having the most relevant > entries closest to the subsequent shell prompt? > Everything is visible on the screen in that case either way. > > Feel free to commit something like this (with or without the .??*, > with ot without the -r) based on OK schwarze@, or send an OK to me. > > Yours, > Ingo > > > Index: du.1 > =================================================================== > RCS file: /cvs/src/usr.bin/du/du.1,v > retrieving revision 1.35 > diff -u -r1.35 du.1 > --- du.1 2 Sep 2019 21:18:41 -0000 1.35 > +++ du.1 29 Jan 2020 16:40:13 -0000 > @@ -147,6 +147,11 @@ > .El > .Sh EXIT STATUS > .Ex -std du > +.Sh EXAMPLES > +Display a summary of files and folders in the current directory, > +sorted by size: > +.Pp > +.Dl du -sh * .??* | sort -h
Why the ".??*"? That would miss single (well, double) letter hidden directory names like .a, .b etc. As far as I know, neither ksh(1) nor sh(1) expands .* to .. (which I assume the ?? in .??* is a precaution against). $ ls -la total 4 drwxr-xr-x 2 kk wheel 512 Jan 29 18:03 . drwxr-xr-x 3 kk wheel 512 Jan 29 18:03 .. $ echo .* .* > .Sh SEE ALSO > .Xr df 1 , > .Xr fts_open 3 , -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .
