GNU bug report logs - #12312
Feature Request: du -h or du --si sort by human readable value

Previous Next

Package: coreutils;

Reported by: kat amsterdam <kat.amsterdam <at> gmail.com>

Date: Thu, 30 Aug 2012 19:14:01 UTC

Severity: wishlist

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12312 in the body.
You can then email your comments to 12312 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#12312; Package coreutils. (Thu, 30 Aug 2012 19:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to kat amsterdam <kat.amsterdam <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 30 Aug 2012 19:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: kat amsterdam <kat.amsterdam <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Feature Request: du -h or du --si sort by human readable value
Date: Thu, 30 Aug 2012 20:39:07 +0200
[Message part 1 (text/plain, inline)]
Hi GNU core utility developers:

First of all thank you very much for developing the software that we have
come to rely on. It's well appreciated!

I have a feature request based on a question that was asked on askubuntu.com

the question is: why does du -h  not sort by the human readable value.

Example:

1) du returns random sort order
*du -h /home/user/Photos*

156M /home/user/Photos/cats
124M /home/user/Photos/vacation
1G   /home//user/Photos/family
148K  /home/user/Photos/profile


2) du returns sorted by number but not by acutal value in this example G is
large than M and M is larger than K
*du -h /home/user/Photos | sort -n *

1G   /home//user/Photos/family
124M /home/user/Photos/vacation
148K  /home/user/Photos/profile
156M /home/user/Photos/cats

3) this works partially but is very difficult to remember

du -k * | sort -nr | cut -f2 | xargs -d '\n' du -sh | head -n 10

4) This is even more ridiculous, computers are supposed to do the work for
us, not make attempt impossible memorization tasks.

alias duf='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for
(qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f";
last};$s=$s/1024}'\'


Please add a sorting function to du -h and du --si to sort the human
readable values to make your wonderful utility even more useful.

This is program one time, and it's done for everyone. The entire GNU and
linux communities will be beter for this time saving feature.

-- 
Met vriendelijke groet,
Damiƶn la Bagh
Amsterdam, Nederland
==
globe*one***
Point of sale solutions for Retail and Horeca
[Message part 2 (text/html, inline)]

Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Thu, 30 Aug 2012 20:22:02 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Thu, 30 Aug 2012 20:22:02 GMT) Full text and rfc822 format available.

Notification sent to kat amsterdam <kat.amsterdam <at> gmail.com>:
bug acknowledged by developer. (Thu, 30 Aug 2012 20:22:02 GMT) Full text and rfc822 format available.

Message #12 received at 12312-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: kat amsterdam <kat.amsterdam <at> gmail.com>
Cc: control <at> debbugs.gnu.org, 12312-done <at> debbugs.gnu.org
Subject: Re: bug#12312: Feature Request: du -h or du --si sort by human
	readable value
Date: Thu, 30 Aug 2012 13:20:32 -0700
[Message part 1 (text/plain, inline)]
tag 12312 notabug
thanks

On 08/30/2012 11:39 AM, kat amsterdam wrote:
> Hi GNU core utility developers:
> 
> First of all thank you very much for developing the software that we have
> come to rely on. It's well appreciated!

Thank you.

> 
> I have a feature request based on a question that was asked on askubuntu.com
> 
> the question is: why does du -h  not sort by the human readable value.

du(1) doesn't sort, you use sort(1) for sorting.

> 1) du returns random sort order
> *du -h /home/user/Photos*

to get it in sorted order,

du -h /home/user/Photos* | sort -k1,1h


> 2) du returns sorted by number but not by acutal value in this example G is
> large than M and M is larger than K
> *du -h /home/user/Photos | sort -n *

Don't use sort -n, use sort -h.

> 
> Please add a sorting function to du -h and du --si to sort the human
> readable values to make your wonderful utility even more useful.
> 

We already have: sort -h, in coreutils 7.5 (2009).  Therefore, I'm
closing this bug.

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 28 Sep 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.