From unknown Tue Jun 24 15:41:51 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#17553 <17553@debbugs.gnu.org> To: bug#17553 <17553@debbugs.gnu.org> Subject: Status: du unit suggestion Reply-To: bug#17553 <17553@debbugs.gnu.org> Date: Tue, 24 Jun 2025 22:41:51 +0000 retitle 17553 du unit suggestion reassign 17553 coreutils submitter 17553 Reuben Thomas severity 17553 normal tag 17553 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Thu May 22 15:47:50 2014 Received: (at submit) by debbugs.gnu.org; 22 May 2014 19:47:50 +0000 Received: from localhost ([127.0.0.1]:56898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnYxu-0002xJ-32 for submit@debbugs.gnu.org; Thu, 22 May 2014 15:47:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41212) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnYxo-0002ws-L7 for submit@debbugs.gnu.org; Thu, 22 May 2014 15:47:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnYxi-0004Iw-GV for submit@debbugs.gnu.org; Thu, 22 May 2014 15:47:35 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,HTML_MESSAGE, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnYxi-0004Is-DC for submit@debbugs.gnu.org; Thu, 22 May 2014 15:47:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnYxh-0002mC-Bu for bug-coreutils@gnu.org; Thu, 22 May 2014 15:47:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnYxg-0004IR-Dr for bug-coreutils@gnu.org; Thu, 22 May 2014 15:47:33 -0400 Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:36873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnYxg-0004Hh-4J for bug-coreutils@gnu.org; Thu, 22 May 2014 15:47:32 -0400 Received: by mail-la0-f53.google.com with SMTP id ty20so1493455lab.26 for ; Thu, 22 May 2014 12:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:date:message-id:subject:from:to:content-type; bh=AOQnszw+Yl2ZkChJhey+jKWyJH8F0VPjFn9QMP0+v2U=; b=WGfvMIbkDTRP8R6cdxdM1loTFz1PSoWZwZLrC9lp7cPq9TORYq2EdizYFusUde2df9 TKCj3SfUXSmCb1G7E2sugSx/V6dvIZ8DUz4NjJA14HzZmNfGhYmW8jvo7K+74sFlwaZ6 uvaEb9V4p/iMGXme6w+uvb1Sc9rd6wXmiZlVw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=AOQnszw+Yl2ZkChJhey+jKWyJH8F0VPjFn9QMP0+v2U=; b=GF0XoimqNYPqXZfDwmMdOcLf5K7HhoU3BL0x9mzxZCJ6Kupj2L0DXRx1StfHnSnkjN gfyxkkG6rlVFES7oODPWA7E204W+6SOB4dgn2F1rR20iV6VLEwl8lmdE8/Ud9dJS9p0E 8kT03T32gbzpaQisC9bjLERTO531hy/vA+KYtg7PCv/a1JRz2h5aDqiN2wOOXxeOInnZ Rg7BYip7EQfeWKazocOVEB6a7lqDJ2mR7Vk2E5orETxzv1bcmziOpuSbKxQhyNVWtSGj rl8pMc1RJlz6tau3//IT03e+3jJ98rKS92NfoKD08qa/BYmqdbim5nWOxOV4vDoJD6PZ bjLw== X-Gm-Message-State: ALoCoQl3ydgsAe4oGNT6pW3hOVUBALM+bt6pqB8ccJtZm27ubvyXCXnTbo5NcJrbxYQuUg5ZqtZu MIME-Version: 1.0 X-Received: by 10.152.23.136 with SMTP id m8mr2871laf.2.1400788049646; Thu, 22 May 2014 12:47:29 -0700 (PDT) Received: by 10.152.166.103 with HTTP; Thu, 22 May 2014 12:47:29 -0700 (PDT) Date: Thu, 22 May 2014 20:47:29 +0100 Message-ID: Subject: du unit suggestion From: Reuben Thomas To: bug-coreutils Content-Type: multipart/alternative; boundary=089e0158bf881aebf304fa02621d X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) --089e0158bf881aebf304fa02621d Content-Type: text/plain; charset=UTF-8 It would be helpful to this addle-pated individual if du would output the same units as it accepts as SIZE inputs, so that one could more readily tell whether one was getting 1000-based or 1024-based units. For additional clarity, it would help if for output the suffix were "B" as at present for 1000-based units and "iB" for 1024-based (and correspondingly it would be nice if "iB" suffixed units were accepted as input. As far as input goes, it's backwards-compatible; it's not for output if other programs are trying to parse the human-readable output, but maybe that's not a problem. -- http://rrt.sc3d.org --089e0158bf881aebf304fa02621d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
It would be helpful to this addle-pated individual if= du would output the same units as it accepts as SIZE inputs, so that one c= ould more readily tell whether one was getting 1000-based or 1024-based uni= ts.

For additional clarity, it would help if for output the suffix we= re "B" as at present for 1000-based units and "iB" for = 1024-based (and correspondingly it would be nice if "iB" suffixed= units were accepted as input. As far as input goes, it's backwards-com= patible; it's not for output if other programs are trying to parse the = human-readable output, but maybe that's not a problem.
--089e0158bf881aebf304fa02621d-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 22 18:58:18 2014 Received: (at 17553) by debbugs.gnu.org; 22 May 2014 22:58:18 +0000 Received: from localhost ([127.0.0.1]:57011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnbwI-0001Vf-6j for submit@debbugs.gnu.org; Thu, 22 May 2014 18:58:18 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:9127) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnbwF-0001VQ-TY for 17553@debbugs.gnu.org; Thu, 22 May 2014 18:58:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtkBAFWAflNtTXub/2dsb2JhbAANTINZg0KqQJcBAYEkgxkBAQEEIw8BRhALDQEKAgIFFgsCAgkDAgECAUUGDQEHAQGIQrEOd6UsF4EqjFZOB4J1gUsBA5suhVePSw Received: from unknown (HELO [192.168.1.79]) ([109.77.123.155]) by mail2.vodafone.ie with ESMTP; 22 May 2014 23:58:09 +0100 Message-ID: <537E80FF.2040603@draigBrady.com> Date: Thu, 22 May 2014 23:58:07 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Reuben Thomas Subject: Re: bug#17553: du unit suggestion References: In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 17553 Cc: 17553@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 05/22/2014 08:47 PM, Reuben Thomas wrote: > It would be helpful to this addle-pated individual if du would output the > same units as it accepts as SIZE inputs, so that one could more readily > tell whether one was getting 1000-based or 1024-based units. > > For additional clarity, it would help if for output the suffix were "B" as > at present for 1000-based units and "iB" for 1024-based (and > correspondingly it would be nice if "iB" suffixed units were accepted as > input. As far as input goes, it's backwards-compatible; it's not for output > if other programs are trying to parse the human-readable output, but maybe > that's not a problem. Yes this is not ideal, but it half does what you want: With this file: $ truncate -s 1MiB file.in We can output the appropriate suffixes for a _particular_ power. $ du --apparent-size -BKiB file.in 1024KiB file.in $ du --apparent-size -BKB file.in 1049kB file.in However if we want to auto scale the number with -h we lose the suffix, and have an ambiguity: $ du --apparent-size -h file.in 1.0M file.in $ du --apparent-size -h --si file.in 1.1M file.in If you wanted to get auto scaling with suffixes you could use the new numfmt utility which has various number formatting options. The advantage of that is it concentrates the myriad of number formatting options in a single location, and allows processing of numbers before final presentation by numfmt. For example: $ du -B1 . | sort -k1,1n | numfmt --to=iec-i | tail -n5 104Mi ./gnulib/.git/objects/pack 216Mi ./gnulib/.git/objects 218Mi ./gnulib/.git 274Mi ./gnulib 479Mi . thanks, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Fri May 23 06:13:12 2014 Received: (at 17553) by debbugs.gnu.org; 23 May 2014 10:13:12 +0000 Received: from localhost ([127.0.0.1]:57319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnmTP-0004PO-Ao for submit@debbugs.gnu.org; Fri, 23 May 2014 06:13:11 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:47451) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnmTM-0004PA-Hl for 17553@debbugs.gnu.org; Fri, 23 May 2014 06:13:09 -0400 Received: by mail-la0-f47.google.com with SMTP id pn19so3895384lab.6 for <17553@debbugs.gnu.org>; Fri, 23 May 2014 03:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BJWgvC9eNxEDtOW7LRCmeA5mA9LUXZ4vcU6Cbxt9IXo=; b=K2Dy7sFavtpQEt9uDesNuUB5diRppGP9MITVYjnRkdovhDBWVNvPx1Up0jG4hOcn01 w7j2VyvyNUZA5sLEKaQZ1ElAv7gFcpGD0KmiR9eEKY/MY4wPzo1nX87pxgsM7Ri+xuhG /KOuS2jAyyn+WGna5J4lGJ0QQqwUcWr9BI9/8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=BJWgvC9eNxEDtOW7LRCmeA5mA9LUXZ4vcU6Cbxt9IXo=; b=Bl+r4jde5v24MGQpnImO33GSfJQI4yvk5XB5yk6qqcyQ93Jx/3DI1CVGjuGxzDARXX LXim14P1p+6lXc6hw7pRMWwAqh6inJgh+2nPDrylmaUpjQWHcFJ5OSHzppVBvF8oWyKh qZGG7PSgffyoAKUy29enVgUP9txXtliBTZHitpF0hQ7gN3z37Q7lCmIWJiZ3tbCEFXm3 bni0M+xgBP1XYE/7s+ik9oCcfFvaM97maBuB3Guxv5q8XVwYMGXFFvpqNQFsJeVxL6OA 9q8Z1i8BX1vPzYfUArQ+vAeGL2SRPen15ORIw8b4YATTooIgB2HqosVNH0W5ZKe1R+4E JnDw== X-Gm-Message-State: ALoCoQmdFkA75p9/xExZ3Lnr1y5MQxtr5odKb03GBekfvlKphgaY9jqPeazT3OgB4cBEhGy7L65P MIME-Version: 1.0 X-Received: by 10.152.23.6 with SMTP id i6mr2769766laf.24.1400839982431; Fri, 23 May 2014 03:13:02 -0700 (PDT) Received: by 10.152.166.103 with HTTP; Fri, 23 May 2014 03:13:02 -0700 (PDT) In-Reply-To: <537E80FF.2040603@draigBrady.com> References: <537E80FF.2040603@draigBrady.com> Date: Fri, 23 May 2014 11:13:02 +0100 Message-ID: Subject: Re: bug#17553: du unit suggestion From: Reuben Thomas To: =?UTF-8?Q?P=C3=A1draig_Brady?= Content-Type: multipart/alternative; boundary=089e0160bbee8a515604fa0e79ad X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17553 Cc: 17553@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --089e0160bbee8a515604fa0e79ad Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 22 May 2014 23:58, P=C3=A1draig Brady wrote: > On 05/22/2014 08:47 PM, Reuben Thomas wrote: > > It would be helpful to this addle-pated individual if du would output t= he > > same units as it accepts as SIZE inputs, so that one could more readily > > tell whether one was getting 1000-based or 1024-based units. > > > > For additional clarity, it would help if for output the suffix were "B" > as > > at present for 1000-based units and "iB" for 1024-based (and > > correspondingly it would be nice if "iB" suffixed units were accepted a= s > > input. As far as input goes, it's backwards-compatible; it's not for > output > > if other programs are trying to parse the human-readable output, but > maybe > > that's not a problem. > > Yes this is not ideal, but it half does what you want: > With this file: > > $ truncate -s 1MiB file.in > > We can output the appropriate suffixes for a _particular_ power. > > $ du --apparent-size -BKiB file.in > 1024KiB file.in > $ du --apparent-size -BKB file.in > 1049kB file.in > > However if we want to auto scale the number with -h we lose the suffix, > and have an ambiguity: > > $ du --apparent-size -h file.in > 1.0M file.in > $ du --apparent-size -h --si file.in > 1.1M file.in > > If you wanted to get auto scaling with suffixes you could use > the new numfmt utility which has various number formatting options. > The advantage of that is it concentrates the myriad of number formatting > options in a single location, and allows processing of numbers before > final presentation by numfmt. For example: > > $ du -B1 . | sort -k1,1n | numfmt --to=3Diec-i | tail -n5 > 104Mi ./gnulib/.git/objects/pack > 216Mi ./gnulib/.git/objects > 218Mi ./gnulib/.git > 274Mi ./gnulib > 479Mi . > Thanks for clarifying what is possible. Currently du's behaviour is more inconsistent than I'd realised. I see that if one wanted more complicated units it would make sense to use an external utility, but here I'd just like -h's output to be consistent with --apparent-size's output. It seems that -iB suffixed units are already accepted as input, which was my second request, but not documented in the man page. I'd like to fix this, but without duplicating information. What's best: to add a phrase saying that SI units are accepted and/or to make a cross-reference to the relevant node of the info manual? --=20 http://rrt.sc3d.org --089e0160bbee8a515604fa0e79ad Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 2= 2 May 2014 23:58, P=C3=A1draig Brady <P@draigbrady.com> wrote= :
On 05/22/2014 08:47 PM, Reuben Thomas wrote:
> It would be helpful to this addle-pated individual if du would output = the
> same units as it accepts as SIZE inputs, so that one could more readil= y
> tell whether one was getting 1000-based or 1024-based units.
>
> For additional clarity, it would help if for output the suffix were &q= uot;B" as
> at present for 1000-based units and "iB" for 1024-based (and=
> correspondingly it would be nice if "iB" suffixed units were= accepted as
> input. As far as input goes, it's backwards-compatible; it's n= ot for output
> if other programs are trying to parse the human-readable output, but m= aybe
> that's not a problem.

Yes this is not ideal, but it half does what you want:
With this file:

=C2=A0 $ truncate -s 1MiB file= .in

We can output the appropriate suffixes for a _particular_ power.

=C2=A0 $ du --apparent-size -BKiB file.in
=C2=A0 1024KiB =C2=A0 =C2=A0 =C2=A0 file.in
=C2=A0 $ du --apparent-size -BKB file.in
=C2=A0 1049kB =C2=A0 =C2=A0 =C2=A0 =C2=A0file.in

However if we want to auto scale the number with -h we lose the suffix,
and have an ambiguity:

=C2=A0 $ du --apparent-size -h file.in
=C2=A0 1.0M =C2=A0file.in<= br> =C2=A0 $ du --apparent-size -h --si file.in
=C2=A0 1.1M =C2=A0file.in<= br>
If you wanted to get auto scaling with suffixes you could use
the new numfmt utility which has various number formatting options.
The advantage of that is it concentrates the myriad of number formatting options in a single location, and allows processing of numbers before
final presentation by numfmt. For example:

=C2=A0 $ du -B1 . | sort -k1,1n | numfmt --to=3Diec-i | tail -n5
=C2=A0 104Mi ./gnulib/.git/objects/pack
=C2=A0 216Mi ./gnulib/.git/objects
=C2=A0 218Mi ./gnulib/.git
=C2=A0 274Mi ./gnulib
=C2=A0 479Mi .

Thanks for clarifying wh= at is possible. Currently du's behaviour is more inconsistent than I= 9;d realised. I see that if one wanted more complicated units it would make= sense to use an external utility, but here I'd just like -h's outp= ut to be consistent with --apparent-size's output.

It seems that -iB suffixed units are already accepted as input, which w= as my second request, but not documented in the man page. I'd like to f= ix this, but without duplicating information. What's best: to add a phr= ase saying that SI units are accepted and/or to make a cross-reference to t= he relevant node of the info manual?

--
http://rrt.sc3d.org<= /a>
--089e0160bbee8a515604fa0e79ad-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 23 08:12:46 2014 Received: (at 17553) by debbugs.gnu.org; 23 May 2014 12:12:46 +0000 Received: from localhost ([127.0.0.1]:57401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnoL4-0000gc-K2 for submit@debbugs.gnu.org; Fri, 23 May 2014 08:12:46 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:23057) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnoKy-0000g2-PJ for 17553@debbugs.gnu.org; Fri, 23 May 2014 08:12:40 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqABADI6f1NtTtJP/2dsb2JhbAANTINZg0KqWJcCAYEfgxkBAQEDASNWBQsLDQEKCRYLAgIJAwIBAgFFBg0BBQIBAYg1DQixNHelLheOBEkFBwmCbIFLBI1Vg3aBOogqhVdWjnZs Received: from unknown (HELO [192.168.1.79]) ([109.78.210.79]) by mail2.vodafone.ie with ESMTP; 23 May 2014 13:12:30 +0100 Message-ID: <537F3B2D.9090600@draigBrady.com> Date: Fri, 23 May 2014 13:12:29 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Reuben Thomas Subject: Re: bug#17553: du unit suggestion References: <537E80FF.2040603@draigBrady.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------040209060500070101030207" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 17553 Cc: 17553@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) This is a multi-part message in MIME format. --------------040209060500070101030207 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tl;dr You can get what you want currently by doing: du() { env du -B1 "$@" | numfmt --to=iec-i --suffix=B; } Though there are some potential changes. I'm 60:40 against applying the attached block-size-iec-iB.patch I'm 60:40 for applying the attached block-size-help-iB.patch details below... On 05/23/2014 11:13 AM, Reuben Thomas wrote: > On 22 May 2014 23:58, Pádraig Brady wrote: > >> On 05/22/2014 08:47 PM, Reuben Thomas wrote: >>> It would be helpful to this addle-pated individual if du would output the >>> same units as it accepts as SIZE inputs, so that one could more readily >>> tell whether one was getting 1000-based or 1024-based units. >>> >>> For additional clarity, it would help if for output the suffix were "B" >> as >>> at present for 1000-based units and "iB" for 1024-based (and >>> correspondingly it would be nice if "iB" suffixed units were accepted as >>> input. As far as input goes, it's backwards-compatible; it's not for >> output >>> if other programs are trying to parse the human-readable output, but >> maybe >>> that's not a problem. >> >> Yes this is not ideal, but it half does what you want: >> With this file: >> >> $ truncate -s 1MiB file.in >> >> We can output the appropriate suffixes for a _particular_ power. >> >> $ du --apparent-size -BKiB file.in >> 1024KiB file.in >> $ du --apparent-size -BKB file.in >> 1049kB file.in >> >> However if we want to auto scale the number with -h we lose the suffix, >> and have an ambiguity: >> >> $ du --apparent-size -h file.in >> 1.0M file.in >> $ du --apparent-size -h --si file.in >> 1.1M file.in >> >> If you wanted to get auto scaling with suffixes you could use >> the new numfmt utility which has various number formatting options. >> The advantage of that is it concentrates the myriad of number formatting >> options in a single location, and allows processing of numbers before >> final presentation by numfmt. For example: >> >> $ du -B1 . | sort -k1,1n | numfmt --to=iec-i | tail -n5 >> 104Mi ./gnulib/.git/objects/pack >> 216Mi ./gnulib/.git/objects >> 218Mi ./gnulib/.git >> 274Mi ./gnulib >> 479Mi . >> > > Thanks for clarifying what is possible. Currently du's behaviour is more > inconsistent than I'd realised. I see that if one wanted more complicated > units it would make sense to use an external utility, but here I'd just > like -h's output to be consistent with --apparent-size's output. With -B '..B' output you mean? To show all current output possibilities: $ dd bs=1MiB count=2 if=/dev/zero of=file.test $ for B in 1 1000 1024 KB KiB si human; do printf '%s (%s)\n' "$(du -B$B file.test)" "$B" done 2097152 file.test (1) 2098 file.test (1000) 2048 file.test (1024) 2098kB file.test (KB) 2048KiB file.test (KiB) 2.1M file.test (si) 2.0M file.test (human) For backward compat I'm a bit reluctant to have -h (or -Bhuman) without --si output the 'i' suffix. It is tempting though, but another reason not to do this, is the current implementation would also output the 'B' suffix, which might be OK for du, but we also need to consider ls and df where this is also significant. I guess we could extend the --block-size option to support this (simple patch is attached) $ for B in iec-iB si-B; do printf '%s (%s)\n' "$(src/du -B$B file.test)" "$B"; done 2.0MiB file.test (iec-iB) 2.1MB file.test (si-B) However as mentioned the current implementation of this doesn't support outputting the 'i' iec distinguishing char without the 'B' suffix. Also given the messiness in this area I'm reluctant to add to it. numfmt gives all the flexibility you need here and you can setup: du() { env du -B1 "$@" | numfmt --to=iec-i --suffix=B; } That would be more general and just about as awkward as: alias du='du -Biec-iB' > It seems that -iB suffixed units are already accepted as input, which was > my second request, but not documented in the man page. I'd like to fix > this, but without duplicating information. What's best: to add a phrase > saying that SI units are accepted and/or to make a cross-reference to the > relevant node of the info manual? Yes the man page doesn't mention that the integer is optional and the consequences of that, nor does it mention the 'human' and 'si' possibilities. Man pages are a tricky to have the right level of info. BTW having the integer optional was removed from the description in: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9939#53 I've attached a proposed patch to show the -B'MiB' as an option, while leaving the SIZE description as before. thanks, Pádraig. --------------040209060500070101030207 Content-Type: text/x-patch; name="block-size-iec-iB.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="block-size-iec-iB.patch" diff --git a/lib/human.c b/lib/human.c index ab6b30d..d5d5a79 100644 --- a/lib/human.c +++ b/lib/human.c @@ -394,11 +394,20 @@ human_readable (uintmax_t n, char *buf, int opts, # define DEFAULT_BLOCK_SIZE 1024 #endif -static char const *const block_size_args[] = { "human-readable", "si", 0 }; +static char const *const block_size_args[] = + { + "human-readable", + "iec-iB", + "si", + "si-B", + 0 }; + static int const block_size_opts[] = { human_autoscale + human_SI + human_base_1024, - human_autoscale + human_SI + human_autoscale + human_SI + human_base_1024 + human_B, + human_autoscale + human_SI, + human_autoscale + human_SI + human_B }; static uintmax_t --------------040209060500070101030207 Content-Type: text/x-patch; name="block-size-help-iB.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="block-size-help-iB.patch" diff --git a/src/df.c b/src/df.c index 01ecca6..8941632 100644 --- a/src/df.c +++ b/src/df.c @@ -1276,7 +1276,7 @@ or all file systems by default.\n\ fputs (_("\ -a, --all include dummy file systems\n\ -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ - '-BM' prints sizes in units of 1,048,576 bytes;\n\ + '-BMiB' prints sizes in units of 1,048,576 bytes;\n\ see SIZE format below\n\ --total produce a grand total\n\ -h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\ diff --git a/src/du.c b/src/du.c index 890edb6..215cb21 100644 --- a/src/du.c +++ b/src/du.c @@ -299,7 +299,7 @@ Summarize disk usage of each FILE, recursively for directories.\n\ "), stdout); fputs (_("\ -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ - '-BM' prints sizes in units of 1,048,576 bytes;\n\ + '-BMiB' prints sizes in units of 1,048,576 bytes;\n\ see SIZE format below\n\ -b, --bytes equivalent to '--apparent-size --block-size=1'\n\ -c, --total produce a grand total\n\ diff --git a/src/ls.c b/src/ls.c index 25e10fa..6f5fef7 100644 --- a/src/ls.c +++ b/src/ls.c @@ -4793,7 +4793,7 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\ "), stdout); fputs (_("\ --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ - '--block-size=M' prints sizes in units of\n\ + '--block-size=MiB' prints sizes in units of\n\ 1,048,576 bytes; see SIZE format below\n\ -B, --ignore-backups do not list implied entries ending with ~\n\ -c with -lt: sort by, and show, ctime (time of last\n\ --------------040209060500070101030207-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 23 09:02:50 2014 Received: (at 17553) by debbugs.gnu.org; 23 May 2014 13:02:50 +0000 Received: from localhost ([127.0.0.1]:57413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wnp7a-0002ET-6F for submit@debbugs.gnu.org; Fri, 23 May 2014 09:02:50 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:45651) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wnp7X-0002EC-Dk for 17553@debbugs.gnu.org; Fri, 23 May 2014 09:02:48 -0400 Received: by mail-la0-f50.google.com with SMTP id b8so4189366lan.9 for <17553@debbugs.gnu.org>; Fri, 23 May 2014 06:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8S4gPctTuY5Az2Ex+SM/vB8fW9l/n3fptKWGcMTYAeI=; b=udxPig+yOURl48OOzRNoI+OEtcnD3kgVC7JdJCk0KKBB7rH/9Ab/6Gr31vzIdSCIsz 2T29ZoT9AkbwdYcqx+RRORwSqhOWNR/8F1Vt+hCZxGa/U+1GxzAN0UODg4E1UxIKdryJ y77eKCp5dPR2KKSErflrFP1UMl2Y9h0IcHRdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=8S4gPctTuY5Az2Ex+SM/vB8fW9l/n3fptKWGcMTYAeI=; b=CtcI9P6ynJav4o/J9ws4NY0bqA4XfL9/V8UyrEQZAUtOJLDZuSHsaYn/0PXchQWRUV cSeBC7rvsbZ3VUYICR/6Xjzx4A8Ok9wCY8DkW7QpJ1kBk5wiTQBiwlJnZF1kKYK79TXl BbZ+H2sdKvW6yWyge9+UB0cwodijsGphcpVjdYLlgQmSxge++8Fqn7fMzNjg9fiJeJCE 9YuGktpoA/MafmzX9SkojQHce04lsyRSbHhMIZJbNyvgMDJE0YwjrEBLmeL9DODwI52D jZlo6AXVDXx2SNN3BzHWsZEzg8kIwSOJjSvonvweyjFBDOjfKfpCitcHh0tk4nJIGwCJ 6t1A== X-Gm-Message-State: ALoCoQlhY+cMO4d064YjnFbVZpiV9jiHjmEZ347JlKT/i8cNlmiKr4yP7b8xC47WfCW1XuONCCGL MIME-Version: 1.0 X-Received: by 10.152.21.202 with SMTP id x10mr3343238lae.3.1400850160963; Fri, 23 May 2014 06:02:40 -0700 (PDT) Received: by 10.152.166.103 with HTTP; Fri, 23 May 2014 06:02:40 -0700 (PDT) In-Reply-To: <537F3B2D.9090600@draigBrady.com> References: <537E80FF.2040603@draigBrady.com> <537F3B2D.9090600@draigBrady.com> Date: Fri, 23 May 2014 14:02:40 +0100 Message-ID: Subject: Re: bug#17553: du unit suggestion From: Reuben Thomas To: =?UTF-8?Q?P=C3=A1draig_Brady?= Content-Type: multipart/alternative; boundary=089e0158ab683a63c604fa10d8a1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17553 Cc: 17553@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --089e0158ab683a63c604fa10d8a1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 23 May 2014 13:12, P=C3=A1draig Brady wrote: > tl;dr > > You can get what you want currently by doing: > > du() { env du -B1 "$@" | numfmt --to=3Diec-i --suffix=3DB; } > Thanks very much, that's certainly good enough for me. My understanding of the rest of what you wrote is that fixing the inconsistency in du's output is complicated by backwards compatibility, and because the code used to do so is used elsewhere in coreutils. Pity. It'd certainly be nice to see consistent output by default. With -B '..B' output you mean? > Sorry, yes. Thanks very much for your efforts. --089e0158ab683a63c604fa10d8a1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 23 May 2014 13:12, P=C3=A1draig Brady <P@draigbrady.com= > wrote:
tl;dr

=C2=A0 You can get what you want currently by doing:

=C2=A0 =C2=A0 du() { env du -B1 "$@" | numfmt --to=3Diec-i --suff= ix=3DB; }

Thanks very much, that's = certainly good enough for me.

My understanding of the res= t of what you wrote is that=20 fixing the inconsistency in du's output is complicated by backwards=20 compatibility, and because the code used to do so is used elsewhere in=20 coreutils. Pity. It'd certainly be nice to see consistent output by def= ault.

With -= B '..B' output you mean?

Sorry, yes.

T= hanks very much for your efforts.
--089e0158ab683a63c604fa10d8a1-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 02 13:51:44 2014 Received: (at control) by debbugs.gnu.org; 2 Jun 2014 17:51:44 +0000 Received: from localhost ([127.0.0.1]:41203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WrWOZ-0008TT-SU for submit@debbugs.gnu.org; Mon, 02 Jun 2014 13:51:44 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:55023) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WrWOT-0008TB-Mf for control@debbugs.gnu.org; Mon, 02 Jun 2014 13:51:38 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id B8D72A6003F for ; Mon, 2 Jun 2014 10:51:27 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vd7c9QQNynpL for ; Mon, 2 Jun 2014 10:51:19 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 45677A60028 for ; Mon, 2 Jun 2014 10:51:19 -0700 (PDT) Message-ID: <538CB997.5030706@cs.ucla.edu> Date: Mon, 02 Jun 2014 10:51:19 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: cleaning up some coreutils bugs Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) tags 17384 notabug close 17384 tags 17553 notabug close 17553 forcemerge 16530 16955 From unknown Tue Jun 24 15:41:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 01 Jul 2014 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 18 20:05:45 2014 Received: (at control) by debbugs.gnu.org; 19 Sep 2014 00:05:46 +0000 Received: from localhost ([127.0.0.1]:44905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUlhp-00036s-Em for submit@debbugs.gnu.org; Thu, 18 Sep 2014 20:05:45 -0400 Received: from mail4.vodafone.ie ([213.233.128.170]:2110) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUlhl-00036d-Pk; Thu, 18 Sep 2014 20:05:42 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At8BAEhyG1RtTryT/2dsb2JhbAANU4NgUwQBgn/GTYZ5VAGBIAGEfQEBBCMECwFGEAsNCwICBRYLAgIJAwIBAgFFBg0BBwEBBYg6AwWrAniWPQEXgSyLAoNJB4J4gVMBBJYFiGeGEocXiCYegVprAYJJAQEB Received: from unknown (HELO [192.168.1.79]) ([109.78.188.147]) by mail3.vodafone.ie with ESMTP; 19 Sep 2014 01:05:39 +0100 Message-ID: <541B7352.3050204@draigBrady.com> Date: Fri, 19 Sep 2014 01:05:38 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: "Linda A. Walsh" Subject: Re: bug#18503: [bug-report] the output of ls -lsh References: <541B6814.7060906@tlinx.org> In-Reply-To: <541B6814.7060906@tlinx.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control Cc: 18503@debbugs.gnu.org, gemfield X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) unarchive 17553 forcemerge 17553 18503 stop On 09/19/2014 12:17 AM, Linda A. Walsh wrote: > gemfield wrote: >> Hi, >> I am running ls -lsh on kubuntu 14.04, here is the output: >> gemfield@gemfield-ThinkPad-Edge:~$ ls -ls >> 4 -rw-rw-r-- 1 gemfield gemfield 9 9 18 23:12 test >> gemfield@gemfield-ThinkPad-Edge:~$ ls -lsh >> 4.0K -rw-rw-r-- 1 gemfield gemfield 9 9 18 23:12 test >> the "4" colored by green means 4 blocks, so why becomes 4.0K blocks >> when add -h option to ls -ls? >> > 4 * 1K blocks = 4.0K blocks. ^^^^^^ -> bytes I think the ambiguity is that there is no unit output. With the human output options, bytes are the implicit unit rather than blocks. The documentation on the human output options does mention that bytes are being specified rather than blocks: http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size Ideally you're right that we should be outputting 4KB or more accurately 4KiB, though due to backward compat concerns we use the less verbose but more ambiguous format. For more explicit conversions you can run ls through the numfmt utility as described at http://bugs.gnu.org/17553 In fact the issues are much the same as with that bug so I'll merge them. thanks, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 18 20:45:08 2014 Received: (at control) by debbugs.gnu.org; 19 Sep 2014 00:45:08 +0000 Received: from localhost ([127.0.0.1]:44920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUmJv-0005O4-5B for submit@debbugs.gnu.org; Thu, 18 Sep 2014 20:45:07 -0400 Received: from mail6.vodafone.ie ([213.233.128.184]:1436) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUmJs-0005KY-HB for control@debbugs.gnu.org; Thu, 18 Sep 2014 20:45:05 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApcBAOF7G1RtTryT/2dsb2JhbAANU5IBwDCDIAGBIAGEfQEBBIEJCw0UFg8JAwIBAgFFBg0IAQGIP6pzlzUBF4wug1CESwEEpH6PcYFEgzUBAQE Received: from unknown (HELO [192.168.1.79]) ([109.78.188.147]) by mail3.vodafone.ie with ESMTP; 19 Sep 2014 01:45:03 +0100 Message-ID: <541B7C8F.7010706@draigBrady.com> Date: Fri, 19 Sep 2014 01:45:03 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: GNU bug tracker automated control server Subject: Re: Processed (with 1 errors): Re: bug#18503: [bug-report] the output of ls -lsh References: <541B7B9C.1020104@draigBrady.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) unmerge 18503 unarchive 17838 forcemerge 17838 18503 From unknown Tue Jun 24 15:41:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 17 Oct 2014 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 28 14:04:22 2024 Received: (at control) by debbugs.gnu.org; 28 Apr 2024 18:04:22 +0000 Received: from localhost ([127.0.0.1]:51509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s18sw-0002IZ-Bo for submit@debbugs.gnu.org; Sun, 28 Apr 2024 14:04:22 -0400 Received: from mail-yw1-x112a.google.com ([2607:f8b0:4864:20::112a]:50442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s18sv-0002IR-2k for control@debbugs.gnu.org; Sun, 28 Apr 2024 14:04:21 -0400 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-61b2218ab6fso26912807b3.1 for ; Sun, 28 Apr 2024 11:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; t=1714327436; x=1714932236; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=qBIPRG/x2mGhcU/6WgnSS18LxOpi/S+J7V0mFO3cEr8=; b=z1VY1JEfIHIVo2JPLFL6aQ23B6iwaCHTZ+Xs1Dzs9wUV4lo6AaJnPFofI3VzMrzrkz 77GZ8OFZzF1aCFBNPjhckQOtrhmD5pcNMtdqISg75esdpOuWIZoUo0cZGGUCsUzrS9TY KD2XrkgmI8rHXby8B/iV8zMulQoKkXJIyvhu0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714327436; x=1714932236; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qBIPRG/x2mGhcU/6WgnSS18LxOpi/S+J7V0mFO3cEr8=; b=HUiOqdDdd4LVYoM9H2hC7auV6eAbx5Q6Rr4sbPCkDwHog9/+WI+XL/3oTA6uLs11ej ZRqyPGtUV8kNs5vmTDQ3UvotIXcS0cVAn2h1Jvc2kJCMYg/ftq/nVmezJF8Zul2ar8Pj UAv4RNlaHmQHQkorTgBsfRm+xWBxahHUCuKH5dyJWcpOvbR19TQSBQcsC/cz6/Ns7jyO 27i3nihFfAlqImibtWhOuYwAm1YBBhjdKjaKEq4R1BaULWJ/1o5GtbgK8l9mHqzdpidU LnMXG9fWV/zlS6oEXbNcDyXGjM1zIuXGpW6rZ0J8x12nQRSCYYIwdNDiEI4c6PPpRHGX UV3A== X-Gm-Message-State: AOJu0YyTk0x44iL9Hyd83fGw4l5ZDS8dXAAuiAjIgCVl9fKXDe0n18GE LUVq8FB213s4VDtAg6FfvkxgcOzSu8s67AfFk5dvjxPHjpH6VUvgbgYEMn/mNfJRqG9Pli8YCpb bcU0kJenlK4v1Hy7o8GimtW4gAxf+LBVJp02zz2lxZba5IA7MbvE= X-Google-Smtp-Source: AGHT+IGMkAT+VJWFE+azK0ftAY8V0SLu6gPkj9nOlUJOin0UjXgJOzETNDKoSh4B9KE8ipbe9Ovg6VDSmESOu544iSU= X-Received: by 2002:a05:690c:d81:b0:61b:3304:b724 with SMTP id da1-20020a05690c0d8100b0061b3304b724mr8247529ywb.10.1714327435556; Sun, 28 Apr 2024 11:03:55 -0700 (PDT) MIME-Version: 1.0 From: Reuben Thomas Date: Sun, 28 Apr 2024 20:03:44 +0200 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: multipart/alternative; boundary="000000000000d3624506172bf53b" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: unarchive 17553 unarchive 17553 Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 HTML_MESSAGE BODY: HTML included in message -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:112a listed in] [list.dnswl.org] 0.0 TVD_SPACE_RATIO No description available. 2.0 BLANK_SUBJECT Subject is present but empty X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) --000000000000d3624506172bf53b Content-Type: text/plain; charset="UTF-8" unarchive 17553 --000000000000d3624506172bf53b Content-Type: text/html; charset="UTF-8"
unarchive 17553

--000000000000d3624506172bf53b-- From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 28 14:10:28 2024 Received: (at 17553) by debbugs.gnu.org; 28 Apr 2024 18:10:28 +0000 Received: from localhost ([127.0.0.1]:51536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s18yn-0002N1-47 for submit@debbugs.gnu.org; Sun, 28 Apr 2024 14:10:28 -0400 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]:51483) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s18yd-0002Mn-9n for 17553@debbugs.gnu.org; Sun, 28 Apr 2024 14:10:23 -0400 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-61587aa9f4cso42466027b3.3 for <17553@debbugs.gnu.org>; Sun, 28 Apr 2024 11:09:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; t=1714327790; x=1714932590; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YqVEfqrNN0Ei/PbrKQnzP3P1O8mfP0tnI7egqw3LbzQ=; b=2dWUaCndSyKQnXxeymcnYOBvhTm0qmbbfMGy03yN3eb45UD+4u13iop6/+cBpjIdWx CQkI1qzNdkqNCxum8JdJqJxfqrHky8zyEDh7rkd/3ObCBHPvpBjTA0ry6lZpnHImbXqT I9ZY3VZ+n6HOlmuX9HNUZyDA8HrxpxXoKW/qQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714327790; x=1714932590; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YqVEfqrNN0Ei/PbrKQnzP3P1O8mfP0tnI7egqw3LbzQ=; b=PN5I0JnuJhwmBF/J85ZAgMgr/WHBjVrQM0wHJIETdy2wEznvAVcXfS2q9Re6l9zAlf 2nv5r+9Xbj9OOHDQJlJ0EMXLqgK9IyD6VFWGARG+V8echYKYYLBzN76OvMerYwBhtbCH N4SgY2CS8K5MYrlEgJ4vPj0IiC+TFVCpemJUytrme3ggW8yTY/FhHJlhBTxSuNyZasTl JKBKI3NNEQdei1RZuBsNxaYWENWh1jJMsOfZCaBauVqq6b68Wst8dm05Dwo5hJPNMlmZ krA0rWDjEJcLe1LQKLVDUwL23OjfF373gro67v2l7/y5X9zTRxCZuTQctm3/O7VpQYSh 1epw== X-Gm-Message-State: AOJu0YwWqLLX/EQquEdzPvuIpkL+wrTyG8Ss7124+1WtSc9gHzbd1R1C gClkUEj/38DPEZq5uEZ0cPnQH1jBJPDSV619jSc6Jfg2v86rZZmAs8JnBnKlhzVHKGKr7xjFLTh qG2OJ1DQIBqsodFEOeU3Iu0lSejE460Y4AYF8EpVoDt4SBKMNZlQ= X-Google-Smtp-Source: AGHT+IFDjwwt8cjZZyLeZJ2melIDmUhQtTJggecqshlr84WBY2ii3ii1yco+Sk8sjvRXpeDguxs07yeQEYVehGH6OMQ= X-Received: by 2002:a05:690c:7087:b0:61b:33fc:ad8f with SMTP id jg7-20020a05690c708700b0061b33fcad8fmr8911059ywb.45.1714327790045; Sun, 28 Apr 2024 11:09:50 -0700 (PDT) MIME-Version: 1.0 References: <537E80FF.2040603@draigBrady.com> <537F3B2D.9090600@draigBrady.com> In-Reply-To: From: Reuben Thomas Date: Sun, 28 Apr 2024 20:09:38 +0200 Message-ID: Subject: Re: bug#17553: du unit suggestion To: =?UTF-8?Q?P=C3=A1draig_Brady?= Content-Type: multipart/alternative; boundary="000000000000f4695106172c0a5f" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 17553 Cc: 17553@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000f4695106172c0a5f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 23 May 2014 at 15:02, Reuben Thomas wrote: > On 23 May 2014 13:12, P=C3=A1draig Brady wrote: > >> tl;dr >> >> You can get what you want currently by doing: >> >> du() { env du -B1 "$@" | numfmt --to=3Diec-i --suffix=3DB; } >> > > Thanks very much, that's certainly good enough for me. > Today I found that this doesn't cope with filenames that contain newlines, but it's easy to fix: du() { env du "$@" --block-size=3D1 --null | numfmt --zero-terminated --from=3Dauto --to=3Diec-i --suffix=3DB | tr '\0' '\n'; } --=20 https://rrt.sc3d.org --000000000000f4695106172c0a5f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On F= ri, 23 May 2014 at 15:02, Reuben Thomas <rrt@sc3d.org> wrote:
On 23 May 2014 13:12, P=C3=A1draig Brady <P@draigbrady.com>= ; wrote:
tl;dr

=C2=A0 You can get what you want currently by do= ing:

=C2=A0 =C2=A0 du() { env du -B1 "$@" | numfmt --to=3Diec-i --suff= ix=3DB; }

Thanks very much, that's = certainly good enough for me.
=
Today I found that this doesn't cope with filenames that cont= ain newlines, but it's easy to fix:

du(= ) { env du "$@" --block-size=3D1 --null | numfmt --zero-terminate= d --from=3Dauto --to=3Diec-i --suffix=3DB | tr '\0' '\n'; }=

--
--000000000000f4695106172c0a5f-- From unknown Tue Jun 24 15:41:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 27 May 2024 11:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator