[TUHS] Command line options and complexity

Steve Nickolas usotsuki at buric.co
Thu Mar 12 13:34:46 AEST 2020

On Thu, 12 Mar 2020, Greg 'groggy' Lehey wrote:

> 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.

Well, I think one or the other would be desirable.  I figured -a was the 
better to keep - since it shows all dotfiles where -A leaves off . and .. 

>> 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.

Of course. ;)


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

-h is a gnuism, isn't it?

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html does 
specify the -S switch.  That's POSIX, isn't it?

> 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.


Honestly if the date format weren't standardized as it were, I would've 
standardized on "yyyy-mm-dd,mm:ss" - which wouldn't need special 
processing in order to pump into sort(1).

>> 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.

Perhaps true.


> 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.

I was using the link I referenced as my "standard", which doesn't have any 
of those.

I can take or leave color ls.  I don't like the GNU defaults because dark 
blue is TOO dark on my default settings.  I think the flags are adequate 
to know what kind of file I'm dealing with.

> -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
>    -removed.

I used to use "dir|sort" a lot on PC DOS before it got "dir /o" in 5.0.  I 
wouldn't have a problem with removing sort from ls altogether.


> 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
> modern.


More information about the TUHS mailing list