[TUHS] Command line options and complexity

Greg 'groggy' Lehey grog at lemis.com
Thu Mar 12 13:09:17 AEST 2020

On Wednesday, 11 March 2020 at 20:53:12 -0400, Steve Nickolas wrote:
> I went through all the switches defined by POSIX, and figured that
> those 26 could be cut down.

A brave man to defy POSIX!  I wasn't so brave, which is why we have
the -y option.

> My concept reduced the number of switches from 26 to 9 (FLRadfiln).
> Of course, the idea is to be more minimalist than POSIX, so some
> people's opinions on what is or isn't necessary may differ from
> mine.

OK, let's compare notes:

> I felt -A was a redundant "almost -a".

Arguably -a could go too.  The distinction seems arbitrary.

> I felt -C and -x were redundant because a tool like column(1) could be
> used to do the same job (even though column(1) isn't POSIX).

Neither would this ls(1) be.

> I felt -H was a redundant "almost -L".

No arguments, but I suspect that somebody had a good reason for this
distinction, and removing it could cause problems.

> I felt -S, -r and -t could be implemented in other ways using sort(1).

-S isn't POSIX.  And to implement it without an option would mean
removing -h.

As I mentioned earlier, -t can't be done by a filter without
significantly modifying the timestamp output.  That was my rationale
for the -D option, which allows sorting by an external filter.

-r could work.

> I felt -c and -u were meaningless, but that's because of the filesystems I
> usually work with that do not have functional equivalents.  -u for one is
> completely useless on VFAT even though it has such timestamps!  YMMV.

I think this says more about your file systems than about the options.
I find both incredibly useful, and there's no easy way to get the
information elsewhere.  stat(1) would be an option, but then that
could replace ls(1) completely.

> I felt -g and -o could be replaced by cut(1).

-g is already obsolete in FreeBSD (accepted and ignored).  -o has
already been repurposed (show file flags).

> I felt -k wasn't really all that important.  Just halve the numbers.


> I felt -m wasn't really all that important.  There's other ways to convert
> to that format, no doubt, through filters.

Possibly.  Certainly I wouldn't miss it.

> I felt -p was a redundant "almost -F".


> I felt -q could be done just fine with something like tr(1).

I think that it could be replaced by -b.  "?" isn't really very

> I felt -s was a redundant "kindasorta -l".

I can't agree with that, but I've never used it.  The only sensible
use would appear to be talking about disk blocks, but on FreeBSD at
any rate it looks at the BLOCKSIZE environment variable, which I have
set to 1048576 (so that utilities will display in MB where
appropriate), and that's what -s does too:

   2079 -rw-r--r--  1 grog  wheel   2,178,735,915  4 Oct 11:15 Willkommen-bei-den-Honeckers---Spielfilm,-Deutschland-2016-20191003-125200.mp4

That makes it pretty useless.

So, any others?

-G: Colorized output.  I'd be *really* happy to get rid of this, but
    it's not easy to instate with a filter, so I suppose there are
    enough people who like it that it will have to stay.

-P: Seems only to be there to cancel a -H or -L.

-W: "Display whiteouts when scanning directories".  I don't even
    understand what that is.

-a: See discussion of -A.

--color: Again, no thanks.

-f: We haven't really discussed this one.  If you want to remove -S,
    -r and -t, then arguably -f should become the default and be

-n: Make it the default and require a filter to convert group and user
    numbers to IDs.

-y: If we get rid of all sorting, it will no longer be needed.

-,: Make the option standard: output numbers with commas every 3
    digits.  Then this option specification wouldn't be needed.

Of course, none of this will happen.  But it is interesting to think
about it.  In particular, options like -g and -o, which are no longer

Sent from my desktop computer.
Finger grog at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200312/ff080eae/attachment.sig>

More information about the TUHS mailing list