From owner-freebsd-questions@FreeBSD.ORG Mon Dec 17 14:31:31 2007 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 5BE2216A469 for ; Mon, 17 Dec 2007 14:31:31 +0000 (UTC) (envelope-from greenwood.andy@gmail.com) Received: from mtao02.charter.net (mtao02.charter.net [209.225.8.187]) by mx1.freebsd.org (Postfix) with ESMTP id 1112C13C457 for ; Mon, 17 Dec 2007 14:31:30 +0000 (UTC) (envelope-from greenwood.andy@gmail.com) Received: from aarprv06.charter.net ([10.20.200.76]) by mtao02.charter.net (InterMail vM.7.08.03.00 201-2186-126-20070710) with ESMTP id <20071217143130.JRXQ27011.mtao02.charter.net@aarprv06.charter.net>; Mon, 17 Dec 2007 09:31:30 -0500 Received: from agreenftp.no-ip.com ([75.137.120.205]) by aarprv06.charter.net with ESMTP id <20071217143130.VTXM14098.aarprv06.charter.net@agreenftp.no-ip.com>; Mon, 17 Dec 2007 09:31:30 -0500 Received: from localhost (localhost [127.0.0.1]) by agreenftp.no-ip.com (Postfix) with ESMTP id BF5973985E; Mon, 17 Dec 2007 09:31:29 -0500 (EST) Received: from agreenftp.no-ip.com ([127.0.0.1]) by localhost (zeus.agreenftp.no-ip.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z91rvGpVB1-C; Mon, 17 Dec 2007 09:31:26 -0500 (EST) Received: from hercules.nuvox.net (216.215.202.5.nw.nuvox.net [216.215.202.5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: andy) by agreenftp.no-ip.com (Postfix) with ESMTPSA id 9D7353985C; Mon, 17 Dec 2007 09:31:26 -0500 (EST) X-Virus-Scanned: amavisd-new at agreenftp.no-ip.com Message-ID: <4766884F.2070809@gmail.com> Date: Mon, 17 Dec 2007 09:31:43 -0500 From: Andy Greenwood User-Agent: Thunderbird 2.0.0.6 (X11/20071101) MIME-Version: 1.0 To: DAve References: <32989.217.114.136.135.1197898685.squirrel@mail.dsa.es> <47667E61.70602@gmail.com> <47668320.5000706@pixelhammer.com> In-Reply-To: <47668320.5000706@pixelhammer.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Chzlrs: 0 Cc: freebsd-questions@freebsd.org Subject: Re: How to know total number of bytes of a directory X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2007 14:31:31 -0000 DAve wrote: > Andy Greenwood wrote: > >> DSA - JCR wrote: >> >>> Hi all >>> >>> I would like to know the total number of bytes of a directory and its >>> related subdirs, occupied by the files inside it. I haven't found any >>> command for knowning it. >>> >>> >> # du -s /etc >> 17008 /etc >> >> You need read privs to all the subdirectories, otherwise you'll get >> permission errors and it'll skip those. Note that this displays usage in >> 512-byte blocks, not bytes, but you should be able to figure it out from >> there. >> > > -h provides human readable output. > du -sh /etc > 3.8M /etc > > DAve > > Ahh, I had forgotten about -h. I ususally use du -s * | sort -rn | head to find the biggest files/directories in a given directory, and if you use -h, you'll get stuff out of order, since 3.8M will come after 4.2K in a reversed numerical sort.