From owner-freebsd-questions Mon Jan 29 23:20:19 2001 Delivered-To: freebsd-questions@freebsd.org Received: from magus.nostrum.com (magus.nostrum.com [216.90.209.2]) by hub.freebsd.org (Postfix) with ESMTP id C14B437B4E0 for ; Mon, 29 Jan 2001 23:20:00 -0800 (PST) Received: (from pckizer@localhost) by magus.nostrum.com (8.11.0/8.11.0) id f0U7JxN10913; Tue, 30 Jan 2001 01:19:59 -0600 (CST) Message-Id: <200101300719.f0U7JxN10913@magus.nostrum.com> From: Philip Kizer To: freebsd-questions@FreeBSD.ORG Subject: Re: ls -h In-reply-to: Your message of "Mon, 29 Jan 2001 21:53:30 PST." <200101300553.VAA16932@rushe.aero.org> Date: Tue, 30 Jan 2001 01:19:59 -0600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG "Mike O'Brien" wrote: > I don't know what 'ls -h' does on Linux, but 'ls -s' might do >what you want. It gives the size of the file in blocks, followed by >the file name. It's ideal for piping into 'sort'. I have a feeling he means something to help parsing the numbers when you start getting file sizes with more than 6 digits or so... The first option is just to 'make install clean' in '/usr/ports/misc/gnuls' and use the same option as on Linux as you'd then be using the same tool. Personally, I never much cared for adding gnuls; I just don't like the way it changes all file sizes to be no more than 3 digits with a multiplier suffix (i.e. 21k, 951, 37k, 3.9k, 1.0M, 37k), as that doesn't jump out at me visually enough. So, I just use a small 3-line perl filter (it requires Number::Format module for the hard work): --- commaize ------------------------------------ #!/usr/local/bin/perl -wp # Trivial hack by Philip Kizer use Number::Format qw(:subs); s/(^|\s)(\d{4,})/$1 $2/g; s/\s(\d{4,})/format_number($1)/ge; then I just invoke it as "ls -l | commaize" when needed to help discern really large file sizes. -philip -- Philip Kizer, USENIX Liaison to Texas A&M University Texas A&M CIS Operating Systems Group, Unix To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message