From owner-freebsd-questions@FreeBSD.ORG Sat Apr 2 16:15:35 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB7821065670 for ; Sat, 2 Apr 2011 16:15:35 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 32DE98FC08 for ; Sat, 2 Apr 2011 16:15:35 +0000 (UTC) Received: by bwz12 with SMTP id 12so3887160bwz.13 for ; Sat, 02 Apr 2011 09:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=0TNvCfwnvLAQsVbxJ/4879d8E0ZFWPP2RsTO0DArUgw=; b=Zgo64GObNABI7MGmcXPrYoYZT6pnYnVmtcElIsKON6tRBdGSqb5uuNRIvjVMX3YDd6 59CP3pWT21GjWDuow9WbCMxCpqtyMo0eTggHW0bJMTAA89GoV9JKom/rdOlYmL1wF18p s/o33V7eTNTELwRykhuKkRlD8O8gtdNhKM3Jw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=KpLr0ZkRw+PjqF6ZC/LcsapN5VyV45gaopYWqbMqusWFrqqh48J8EwZZM564tXSvTD v2YK/KKq39To93yCxeBWI4LTFhjHbvIff/oOjLXYEnv9GQ4kFsC0QUZjGUoOQdylMsBq N+MPLZOr1XrhMHKm6Pg0OiejbrL5NYDNk4Na4= Received: by 10.204.230.194 with SMTP id jn2mr959530bkb.133.1301760934124; Sat, 02 Apr 2011 09:15:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.205.64.142 with HTTP; Sat, 2 Apr 2011 09:15:04 -0700 (PDT) In-Reply-To: <0DD2BF5C-7387-4AFA-BF43-B1683F3773E8@d3photography.com> References: <0DD2BF5C-7387-4AFA-BF43-B1683F3773E8@d3photography.com> From: Chris Rees Date: Sat, 2 Apr 2011 17:15:04 +0100 Message-ID: To: Ryan Coleman Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Mailing List Subject: Re: graphical representation of `du` X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: utisoft@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Apr 2011 16:15:35 -0000 On 2 April 2011 15:20, Ryan Coleman wrote: > I found this command: > ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ =A0= /' -e 's/-/|/' > > Which makes this: > =A0 |-Mar17 > =A0 |---1300074369-chow > =A0 |-----download > =A0 |-------small > =A0 |---1300421616-Cunningham > =A0 |-----download > =A0 |-------small > > But I want to use `du` instead to convert this > 2.0M =A0 =A0./Mar17/1300074369-chow/download/small > 2.0M =A0 =A0./Mar17/1300074369-chow/download > 2.0M =A0 =A0./Mar17/1300074369-chow > 2.1M =A0 =A0./Mar17/1300421616-Cunningham/download/small > 2.1M =A0 =A0./Mar17/1300421616-Cunningham/download > 2.1M =A0 =A0./Mar17/1300421616-Cunningham > 4.1M =A0 =A0./Mar17 > > into this: > =A0 |-Mar17 [4.3M] > =A0 |---1300074369-chow [2.0M] > =A0 |-----download [2.0M] > =A0 |-------small [2.0M] > =A0 |---1300421616-Cunningham [2.1M] > =A0 |-----download [2.1M] > =A0 |-------small [2.1M] > > > I realize it does it backwards and I can live with that... =A0OR mix the = two to run the first command and run another command to get the folders tot= al size or something... you know? > du -h . | awk '{a[i++]=3D$0} END {for (j=3Di-1; j>=3D0;) print a[j--] }' | awk '{print($2" ["$1"]");}' | sed -e 's,[^-][^/]*/,--,g' -e 's,^,|,' Does it forwards :P [crees@zeus]~/workspace/ports% du -h . | awk '{a[i++]=3D$0} END {for (j=3Di-1; j>=3D0;) print a[j--] }' | awk '{print($2" ["$1"]");}' | sed -e 's,[^-][^/]*/,--,g' -e 's,^,|,' |. [445K] |--net-mgmt [81K] |----CVS [5.5K] |----zabbix-server [74K] |------files [11K] |--------CVS [4.5K] |------CVS [4.5K] ... etc... |--net [31K] |----pppoa [24K] |------CVS [4.5K] |------files [12K] |--------CVS [4.5K] |----CVS [5.5K] [crees@zeus]~/workspace/ports% Any refinements requested I'll have a look at. Chris