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).
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.
(Score: 0) by Anonymous Coward on Wednesday March 04 2020, @05:08AM (2 children)
ls -latr
ls -lSr
mkdir -p ./goodstuff/pr0n
bzip2 -c pr0n.tar.bz2 |(cd goodstuff/pr0n;tar xf -)
chmod 0644 ./goodstuff/pr0n/*.[am][pkv][4vig]
mpv `find ./goodstuff -name '*pr0n*.[am][pkv][4vig]' -print`
rm -i pr0n.tar.bz2
rm -fr ./goodstuff
The vast majority of command line options aren't useful 95% of the time. But the other 5% of the time, they can be very useful. That said, the stuff needed for that other 5% can usually be done without all those extraneous options.
(Score: -1, Flamebait) by Anonymous Coward on Wednesday March 04 2020, @06:14AM (1 child)
sudo rm -rf .
Just sayin'
(Score: 0) by Anonymous Coward on Wednesday March 04 2020, @06:14PM
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?