From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 10669 invoked from network); 14 Mar 2020 19:53:01 -0000 Received-SPF: pass (minnie.tuhs.org: domain of minnie.tuhs.org designates 45.79.103.53 as permitted sender) receiver=inbox.vuxu.org; client-ip=45.79.103.53 envelope-from= Received: from unknown (HELO minnie.tuhs.org) (45.79.103.53) by inbox.vuxu.org with ESMTP; 14 Mar 2020 19:53:01 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id A90D89CD83; Sun, 15 Mar 2020 05:52:58 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 7EFF69CD60; Sun, 15 Mar 2020 05:52:28 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iO17hHL2"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 833299CD60; Sun, 15 Mar 2020 05:52:25 +1000 (AEST) Received: from mail-vs1-f67.google.com (mail-vs1-f67.google.com [209.85.217.67]) by minnie.tuhs.org (Postfix) with ESMTPS id C244C9CD5F for ; Sun, 15 Mar 2020 05:52:22 +1000 (AEST) Received: by mail-vs1-f67.google.com with SMTP id e138so2764791vsc.11 for ; Sat, 14 Mar 2020 12:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9moiaDqvXcOzg6C4Ht/j0bgdpAJzoRxO9W1VryjFpwo=; b=iO17hHL2lBMWCMareWah+2MLuJ+ubeGjqkhzYhfaikZ5MFU3lFqWxXwZjQ9T+XFIjq QYAHvWDDYnhdMW5zFuNpkadr4tZb+F4hdNe7QTi54SnbWQkjbKemA4Y4lrJZ0JNLtC9U pns1MILmbgCQHyWPew8SdfK2BvPxqjRUZ1X1A8oQzSiQMyVywgtkkBVfoI+vUduDwrHE 76ol2TavKD4Ag9nsm38DLRFD9L3XfNRU5PQasVh/T1vqx7bjWpLvOyddFpNW1qBtQyOe /joBKlyInTBBZ2rjRdo77n2aqZ21SD9bT3K4ZqACAyg/+wKAU7dg8v/SWqv3MZXQYVSH Davw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9moiaDqvXcOzg6C4Ht/j0bgdpAJzoRxO9W1VryjFpwo=; b=qTpjmTdL80SnidHTnFUVVdIgwbP6cjQEAMbo+yninmlDuHm8U77KyD0SfOaJXDZjpM kicDRGLOu0HE8/QSpuMxVgIaYhuYqKWFAaXuA1OY51gtBmjJUkLBB7kfLncxInOGkLDh PwC+QwdJBC10u0o5GZg5wn04XjEVcFehU1rvdRCkssYEqrHRk5V47v4padcyP/guazdc RTbJCxp38GBmLAjhCiUU30KzsXxsr+2sw6LvK1X1PlBd3imxwDyZKwthccF7uJRuCp5F wXDgfnCbfck8LUNdXxstCSpYGe83JjPxxMUecWnqBsNs4BNfLg+J7yyF+VH9cifCQWHh Kanw== X-Gm-Message-State: ANhLgQ2MOABuSyh9eO1D1ImRGPNa5Vdbn/01w3pNNionDVnTQGyP789B NGpln31ug3USq5eJ+OXHwXT5aH5l8X1rstvzBK0= X-Google-Smtp-Source: ADFU+vtulLPx+FG2XoBT39J8SP3rwh5U2zQu6isD9btv7dY+dowo7jBxebj4caKyT0rMmEpnutofZ8VkAN9sBPZCgSQ= X-Received: by 2002:a05:6102:2dc:: with SMTP id h28mr13358027vsh.169.1584215541872; Sat, 14 Mar 2020 12:52:21 -0700 (PDT) MIME-Version: 1.0 References: <20200314043505.GD44529@eureka.lemis.com> In-Reply-To: <20200314043505.GD44529@eureka.lemis.com> From: "John P. Linderman" Date: Sat, 14 Mar 2020 15:52:08 -0400 Message-ID: To: "Greg 'groggy' Lehey" Content-Type: multipart/alternative; boundary="0000000000009efb1d05a0d5ece4" Subject: Re: [TUHS] Command line options and complexity X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --0000000000009efb1d05a0d5ece4 Content-Type: text/plain; charset="UTF-8" Here's a command I wrote long ago using a different way to deal with options: *isee* Usage: isee format file ... Display specified inode information for files passed as arguments. Items of the form ``%X'' in format will be replaced for these X: dev inode ino mode nlink uid gid rdev size atime mtime ctime now filename Parenthesized printf-style format specifications can follow a % to override the default format for the various items. %filename is the name of the current file argument. %now is the time (in seconds) when the command started running. The other items are from the stat structure. Example: isee "%(40s)filename: %mtime %mode" /dev/null Show file modification time and mode of /dev/null inode is just a synonym for ino. Instead of a kazillion options, the %-stat-field items identify *what* you want to see and the printf-style formats identify *how* you want them shown. Someone in the Murray Hill library added strftime formats for date fields, a fine addition, in my view. Adding readable user and group names rather than numerical ids would be worth considering. *Maybe* having a "rwx"-style form for mode. Sorting can be done by piping the output through sort. Don't get hung up on shortcomings of the command, just consider how a few familiar concepts and pipes can be combined to provide a large number of options. On Sat, Mar 14, 2020 at 12:35 AM Greg 'groggy' Lehey wrote: > On Friday, 13 March 2020 at 21:45:21 +1100, Dave Horsfall wrote: > > On Fri, 13 Mar 2020, Greg 'groggy' Lehey wrote: > > > >>> -h is a gnuism, isn't it? > >> > >> It might have originated there, but then I would expect it to be spelt > >> '--produce-human-readable-output'. I haven't been able to establish > from the > >> FreeBSD sources or commit logs when it was introduced. It would > clearly have > >> been a reimplementation. > > > > It's in "df" as well, praise Cthulu: > > > > aneurin# df -h > > Filesystem Size Used Avail Capacity Mounted on > > /dev/ad0s1a 496M 302M 154M 66% / > > /dev/ad0s1d 2.9G 1.4G 1.2G 54% /usr > > /dev/ad0s1e 989M 581M 329M 64% /var > ... > > It also has the , option: > > === grog@eureka (/dev/pts/72) ~ 8 -> df -, > Filesystem 1048576-blocks Used Avail Capacity Mounted on > /dev/ada0p4 39,662 21,918 14,571 60% / > /dev/ada0p2 39,662 13,447 23,042 37% /destdir > /dev/ada0p5 3,705,520 1,831,345 1,577,733 54% /home > /dev/ada1p1 7,629,565 6,358,607 1,194,661 84% /Photos > > I find it much easier to see the relative size like that. > > Greg > -- > Sent from my desktop computer. > Finger grog@lemis.com for PGP public key. > See complete headers for address and phone numbers. > This message is digitally signed. If your Microsoft mail program > reports problems, please read http://lemis.com/broken-MUA > --0000000000009efb1d05a0d5ece4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Her= e's a command I wrote long ago using a different way to deal with optio= ns:

=C2=A0 isee
Usage: isee form= at file ...
=C2=A0 =C2=A0 Display specified inode information for files = passed as arguments.
=C2=A0 =C2=A0 Items of the form ``%X'' in f= ormat will be replaced for these X:
dev inode ino mode nlink uid gid rd= ev size atime
mtime ctime now filename
=C2=A0 =C2=A0 Parenthesized p= rintf-style format specifications can follow a %
=C2=A0 =C2=A0 to overri= de the default format for the various items.
=C2=A0 =C2=A0 %filename is = the name of the current file argument.
=C2=A0 =C2=A0 %now is the time (i= n seconds) when the command started running.
=C2=A0 =C2=A0 The other ite= ms are from the stat structure.

=C2=A0 =C2=A0 Example: isee "%(= 40s)filename: %mtime %mode" /dev/null
=C2=A0 =C2=A0 Show file modif= ication time and mode of /dev/null


inode is just a synonym for ino.

Instead of a kazillion options, the %-stat-fie= ld items identify what you want to see and the printf-style formats = identify how you want them shown. Someone in the Murray Hill library= added strftime formats for date fields, a fine addition, in my view. Addin= g readable user and group names rather than numerical ids would be worth co= nsidering. Maybe having a "rwx"-style form for mode. Sorti= ng can be done by piping the output through sort. Don't get hung up on = shortcomings of the command, just consider how a few familiar concepts and = pipes can be combined to provide a large number of options.

=
On Sat, Ma= r 14, 2020 at 12:35 AM Greg 'groggy' Lehey <grog@lemis.com> wrote:
On Friday, 13 March 2020 at 21:45:21 +1100, Dav= e Horsfall wrote:
> On Fri, 13 Mar 2020, Greg 'groggy' Lehey wrote:
>
>>> -h is a gnuism, isn't it?
>>
>> It might have originated there, but then I would expect it to be s= pelt
>> '--produce-human-readable-output'.=C2=A0 I haven't bee= n able to establish from the
>> FreeBSD sources or commit logs when it was introduced.=C2=A0 It wo= uld clearly have
>> been a reimplementation.
>
> It's in "df" as well, praise Cthulu:
>
>=C2=A0 =C2=A0 =C2=A0 aneurin# df -h
>=C2=A0 =C2=A0 =C2=A0 Filesystem=C2=A0 =C2=A0 =C2=A0Size=C2=A0 =C2=A0 Us= ed=C2=A0 =C2=A0Avail Capacity=C2=A0 Mounted on
>=C2=A0 =C2=A0 =C2=A0 /dev/ad0s1a=C2=A0 =C2=A0 496M=C2=A0 =C2=A0 302M=C2= =A0 =C2=A0 154M=C2=A0 =C2=A0 66%=C2=A0 =C2=A0 /
>=C2=A0 =C2=A0 =C2=A0 /dev/ad0s1d=C2=A0 =C2=A0 2.9G=C2=A0 =C2=A0 1.4G=C2= =A0 =C2=A0 1.2G=C2=A0 =C2=A0 54%=C2=A0 =C2=A0 /usr
>=C2=A0 =C2=A0 =C2=A0 /dev/ad0s1e=C2=A0 =C2=A0 989M=C2=A0 =C2=A0 581M=C2= =A0 =C2=A0 329M=C2=A0 =C2=A0 64%=C2=A0 =C2=A0 /var
...

It also has the , option:

=C2=A0 =3D=3D=3D grog@eureka (/dev/pts/72) ~ 8 -> df -,
=C2=A0 Filesystem=C2=A0 1048576-blocks=C2=A0 =C2=A0 =C2=A0 Used=C2=A0 =C2= =A0 =C2=A0Avail Capacity=C2=A0 Mounted on
=C2=A0 /dev/ada0p4=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A039,662=C2=A0 =C2=A0 21,= 918=C2=A0 =C2=A0 14,571=C2=A0 =C2=A0 60%=C2=A0 =C2=A0 /
=C2=A0 /dev/ada0p2=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A039,662=C2=A0 =C2=A0 13,= 447=C2=A0 =C2=A0 23,042=C2=A0 =C2=A0 37%=C2=A0 =C2=A0 /destdir
=C2=A0 /dev/ada0p5=C2=A0 =C2=A0 =C2=A0 3,705,520 1,831,345 1,577,733=C2=A0 = =C2=A0 54%=C2=A0 =C2=A0 /home
=C2=A0 /dev/ada1p1=C2=A0 =C2=A0 =C2=A0 7,629,565 6,358,607 1,194,661=C2=A0 = =C2=A0 84%=C2=A0 =C2=A0 /Photos

I find it much easier to see the relative size like that.

Greg
--
Sent from my desktop computer.
Finger grog@lemis.com for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.=C2=A0 If your Microsoft mail program
reports problems, please read
http://lemis.com/broken-MUA
--0000000000009efb1d05a0d5ece4--