On Mon, Jan 27, 2020 at 10:34:56PM +0100, Sebastian Benoit wrote: > Florian Obser([email protected]) on 2020.01.27 19:57:41 +0100: > > On Mon, Jan 27, 2020 at 10:33:49AM -0700, Todd C. Miller wrote: > > > On Mon, 27 Jan 2020 10:05:41 +1100, Jonathan Gray wrote: > > > > > > > On Sun, Jan 26, 2020 at 11:59:33AM -0500, David Goerger wrote: > > > > > This diff teaches du(1) the -m flag, report disk usage in megabytes. > > > > > This brings us in line with implementations in the other BSDs, Linux, > > > > > and Illumos. > > > > > > > > Why is it needed? -k is required by POSIX, adding arguments for > > > > megabytes, gigabytes, terabytes, petabytes etc seems silly when > > > > there is already 512 byte blocks, kilobytes and -h output. > > > > > > It is useful in conjunction with sort. For example, I often do: > > > > > > du -sk * | sort -rn | head > > > > > > to see the largest disk users. > > > > Me, too. Given its wide spread adoption I think we should implement it. > > OK florian@ > > > > > > > > However, output in kilobytes is less useful than it used to be due > > > to larger files now being common. Using the BLOCKSIZE env var is > > > more flexible but is cumbersome to use and not portable. > > > > > > - todd > > Every time my laptop disk gets full i use a horrible awk construct > to make things readable. I would certainly like to see this. > > Do we need -B for that? I dont think so... > > I'm happy to commit this if nobody complains ;)
There are several commands which have a -k flag for scaling to kilobytes. For example: df du ls pstat quot swapctl Going down the list of unit names kmgtpezy some of these flags are already used. So it would be hard to consistently use -m where -k is used. Adding a flag to take a scalling factor, even if just using an additional char like 'm' to index into a table of scaling factors would use less flags. Though not all of these combinations and uses make sense, and commands could be left inconsistent and not use additional scaling factors other commands use.
