Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Wednesday March 04 2020, @04:51AM   Printer-friendly
from the get-off-my-lawn dept.

The growth of command line options, 1979-Present

The first of McIlroy's dicta is often paraphrased as "do one thing and do it well", which is shortened from "Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new 'features.'" [ . . . ]

If you open up a manpage for ls on mac, you'll see that it starts with

ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file ...]

That is, the one-letter flags to ls include every lowercase letter except for {jvyz}, 14 uppercase letters, plus @ and 1. That's 22 + 14 + 2 = 38 single-character options alone.

On ubuntu 17, if you read the manpage for coreutils ls, you don't get a nice summary of options, but you'll see that ls has 58 options (including --help and --version).

To see if ls is an aberration or if it's normal to have commands that do this much stuff, we can look at some common commands, sorted by frequency of use.

(see article for interesting table.)

We can see that the number of command line options has dramatically increased over time; entries tend to get darker going to the right (more options) and there are no cases where entries get lighter (fewer options).

McIlroy has long decried the increase in the number of options, size, and general functionality of commands:

Everything was small and my heart sinks for Linux when I see the size [inaudible]. The same utilities that used to fit in eight k[ilobytes] are a meg now. And the manual page, which used to really fit on, which used to really be a manual page, is now a small volume with a thousand options... We used to sit around in the UNIX room saying "what can we throw out? Why is there this option?" It's usually, it's often because there's some deficiency in the basic design -- you didn't really hit the right design point. Instead of putting in an option, figure out why, what was forcing you to add that option. This viewpoint, which was imposed partly because there was very small hardware ... has been lost and we're not better off for it.

[ . . . . ] Another reason commands now have more options is that people have added convenience flags for functionality that could have been done by cobbling together a series of commands. These go all the way back to v7 unix, where ls has an option to reverse the sort order (which could have been done by passing the output to tac).

Over time, more convenience options have been added. For example, to pick a command that originally has zero options, mv can move and create a backup (three options; two are different ways to specify a backup, one of which takes an argument and the other of which takes zero explicit arguments and reads an implicit argument from the VERSION_CONTROL environment variable; one option allows overriding the default backup suffix). mv now also has options to never overwrite and to only overwrite if the file is newer.

mkdir is another program that used to have no options where, excluding security things for SELinux or SMACK as well as help and version options, the added options are convenience flags: setting the permissions of the new directory and making parent directories if they don't exist.

[ . . . ] unlike with a GUI, adding these options doesn't clutter up the interface.

(emphasis added)

No worry, systemd will guide us back to the true Unix Microsoft way.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: -1, Flamebait) by Anonymous Coward on Wednesday March 04 2020, @06:14AM (1 child)

    by Anonymous Coward on Wednesday March 04 2020, @06:14AM (#966380)

    sudo rm -rf .

    Just sayin'

    Starting Score:    0  points
    Moderation   -1  
       Flamebait=1, Total=1
    Extra 'Flamebait' Modifier   0  

    Total Score:   -1  
  • (Score: 0) by Anonymous Coward on Wednesday March 04 2020, @06:14PM

    by Anonymous Coward on Wednesday March 04 2020, @06:14PM (#966588)

    sudo rm -rf .

    Just sayin'

    What is it that you're "just sayin'?"

    Firstly, why would I need root privileges to delete my own files?
    Secondly, why would I want to delete the entire current working directory, when all I want to do is delete my used-up pr0n?