Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Poetics of CLI Command Names (smallstep.com)
117 points by tashian on June 9, 2020 | hide | past | favorite | 75 comments


To `useradd` or to `adduser`: that is the question:

Whether 'tis nobler in the mind to suffer

the slings and arrows of outrageous manpage,

or to take up `file` against the output of `which`,

and seek "Perl script text executable"?


You win HN for the day imo!


I concur, bravo! Someone should enshrine this comment somewhere. Sometimes I wish hacker news had a “best of”.


That would be fun. Someone clearly disagreed with me though, for I have one downvote now? Lol.


Hhhmm, I think but I can’t know for certain that it may be because comments that don’t contribute to the discussion are discouraged. So one may argue you could’ve just upvoted. Generally I agree with this approach, but sometimes people just deserve some verbal applause. ¯\_(ツ)_/¯


It does contribute though. I have to type ‘man’ every time I want to add a user to decide which. It’s a great lesson.


Say what you will about PowerShell, the commands are really discoverable and intuitive. The list of approved verbs is helpful too when writing your own cmdlets: https://docs.microsoft.com/en-us/powershell/scripting/develo...


Discoverable? Not for me.

I've been reading the output of 'help' and reading it, and reading it, and I can't see a paradigm (apart from prolixity) or much consistency.

Unix commands have the advantage of brevity, and the inconsistencies somehow aid memorization.


Get-command, Get-member And get-help can make things more discoverable.


Get-Command is your friend, especially with the -Noun parameter.

  Get-Command -Noun Computer 
will return you all the cmdlets dealing with Computer.

It returns Rename, Restart and Stop computer cmdlets.

Very handy.


All those capital letters seem annoying to type to me, though. Is PowerShell case-insensitive?


Yes.


Isn’t that due to Windows (and NTFS (by default)) being case insensitive?


No. PowerShell commands are not necessarily stored on disk.


As mentioned in that document, you can use 'Get-Verb' to list all the approved verbs.

In addition to standard naming of cmdLets, I find it helpful to have my own very short aliases and helper functions defined in my profile, to make powershell more convenient.


They're discoverable in the way that documentation is discoverable.


OS/400, the operating system of the IBM AS/400, has a really consistent pattern to its command names. The format is VERB+NOUN where VERB is a small list of verb abbreviations (ADD=Add,CFG=Configure,CHG=Change,CPY=Copy,CRT=Create,DEL=Delete,DSP=Display,RMV=Remove,STR=Start,WRK=Work With) and likewise there are abbreviations for the type of object the command acts on. So CRTPF=Create Physical File, CRTLIB=Create Library, CRTUSRPRF=Create User Profile, etc.

(OS/400 was later renamed i5/OS, and then renamed again to IBM i. Likewise, AS/400 was renamed iSeries, then System i, and then merged with System p–successor of the RS/6000–to become POWER Systems. But, I prefer IBM's original product names–OS/400 is a far more distinctive name for an operating system called "IBM i", which promotes confusion with Cisco IOS and Apple iOS.)


I also used the AS/400 / System i / IBM i, back when it was called the System/38.

The feature I most miss is command prompting. Type a command name, press F4, and fill in the blanks for the parameters. If a parameter takes enumerated values, type in a question mark (?) and get a list of the allowed values.

That was great for productivity.


Is this like PowerShell's `Show-Command` and the earlier Macintosh Programmer's Workbench Commando?


Yes, same basic concept. Display a fill-in form to guide the user in filling out the command parameters. The main difference is that the OS/400 display a text mode form (5250 block mode terminal form), whereas PowerShell Show-Command and MPW Commando are both GUI tools.


Is this where powershell got it from?


I believe the answer is yes. Jefrrey Snover (inventor of PowerShell) apparently used IBM OS/400 earlier in his career and liked this aspect of it, although PowerShell does implement the idea a little differently (dash between verb and noun; using less abbreviations.)

(Unfortunately, I can't seem to find a direct quote from Mr. Snover stating this, but I can find a number of people saying he has said it before.)



TIL: “you can extend Git by putting an executable in your $PATH called git-[command], and you'll be able to reach it using git [command]”. Cool!


"The more niche your command, the longer its name should be. Very short names should be reserved for utilities people use all the time, like cd, ls, rg."

So I had to read that sentence to find out about rg. I use git grep all day (aliased to gg, making his point), which I guess is a slower alternative.


Watching less experienced students navigate Linux while teaching a networking introduction has also led me to a bias against hyphenated commands. I was surprised at how often newcomers will add a space into these two part commands.

Extra annoyance points if the second part of the command forms a valid sequence of options. I'm looking at you `netstat-nat`.


> Don't start your command name with the letter g even though it's a perfectly fine letter situated right in the center of the keyboard. All past and future g commands are the personal property of Richard Stallman, who in 1983 was granted an exclusive, perpetual, irrevocable, worldwide license to the entire g namespace. Although he grudgingly granted exceptions for git and go, if you're not Linus Torvalds or Google, don't bother hitting him up.

What?


GNU software names tend to have the letter G somewhere. It also shows up in GNU libraries such as GTK and glibc. They export namespaced symbols such as g_printf.

It's just like POSIX's _t suffix. It's "reserved" but in practice nobody cares.


The author is making a joke about ‘gnu’.


As, indeed, is noted below:

> The previous bullet point was a joke.


Ah, missed that. Thanks


I guess it won't hurt to explain the joke.

The Mac has what is sometimes called a "BSD userland" with the result that cp, rm, ls, grep, etc work basically like they do on FreeBSD. But some Mac users prefer the GNU versions of those commands. To avoid breaking scripts that depend on the BSD behavior, when Homebrew installs the GNU versions, it names them gcp, grm, gls, ggrep, etc.


Not just macOS. At my first full-time job, I was introduced to Solaris. I had been using Linux for years, and been using GNU utilities for even longer (through EMX, which is like Cygwin but for OS/2). And the lack of options I was used to from the GNU versions infuriated me. They told me, "just put a g in front". Although it wasn't a standard part of Solaris install, the sysadmin had installed several of the GNU utilities (from sunfreeware.com) and they were present with that prefix.

This custom, of installing GNU utilities with a g-prefix, isn't just on macOS and Solaris, but also on other UNIX flavours as well.


You used to be able to chose the prefix, until Homebrew removed build options.

(You still can on the BSDs.)


Look up the gnuplot name controversy to better understand what's happening here.


That's a little unfair, that explicitly says "GNU" in the name. And it's not GNU, or even GPL. That's rather more egregious than simply beginning with 'g'.


Yggdrasil would be a great name for a command that provides a navigatable tree interface to your file system.

It’d probably quickly get shortened to “ygg”, which feels pretty nice to type to me...


It would probably get confused with Yggdrasil, the hot new "Linux distribution" that everyone is trying.


from wikipedia: "The last release of Yggdrasil was in 1995."


Why is this giving me flashbacks to the time around then when a friend tried downloading Slackware to some insane number of floppy disks.


As a graduate student, I had what was for a while one of the fastest workstations in the department on my desk (they were allocated somewhat randomly), but pretty much everybody could run remote jobs on everybody's workstation.

So I named the workstation "yggdrasil" to make it a bit harder for my colleagues to memorize & type the name…


The VMS systems owned by the math department at Harvey Mudd College in the 80s/90s were given names out of Norse mythology. I'm pretty sure we had an yggdrasil (also pretty sure it was a network hub, but I couldn't say for sure).


I have a vague recollection that my choice of name may have been inspired by a UUCP hostname in a Usenet post, so maybe it was this particular VMS machine.


Possibly, but I suspect it would have been someone else's yggdrasil. The unix system, owned by the bio/cs department (in those days they had one guy who did bio full time, one guy who did cs full-time and one guy who did both) was on uucp, but all the VMS machines were exclusively BITnet until the BITnet protocol and UUCP protocols fell by the wayside with the unification of BITnet/UUCP/Arpanet as the internet.


> The version number should never appear in the command name.

Well, that's nice in theory, but...

> In 50+ years of typing into terminals, we have not figured out how to have multiple versions of things coexist peacefully.

Well, yes, we have. By making the version number appear in the command name. It's not a great solution, but it's a solution. And since you didn't really provide a better one, it's pretty silly to advice against using it.

Also, symlinks are a thing. Nobody (normally) invokes python3.7m directly. There's a symlink pointing to it (or more likely not, as it's probably not the python you want).


Versions should appear when you have multiple versions, not a default behavior.


I'm not sure how you envision that would work. Should the contents of a package mutate when another version of the same package is installed? Would you consider that to be a sane behavior?


No, you use your package manager's alternatives system to manage who gets the "default" name.


Yes, that's covered by the last paragraph of my initial comment - it's generally handled by symlinks already.

jspaetzel seems to think this isn't good enough though, and that the commands should magically just have the non versioned name until multiple versions show up on the same system. I'm curious about how they envision that to work.


>> Consider how your command will be pronounced around the world. Kodak is a word that was designed to sound the same in many languages. lego and ikea might be great command names too, if they weren't already trademarked

Actually, English botches IKEA, which in its native Swedish and presumably most other continental European languages is something like ee-kéa. It took me a while to decipher, first time I heard about eye-keer.


If we could just get a standard for -? or /? or --? I would be happy already.


We do? It's -a for short options, --foo for long options, and /too for DOS/Windows. Some commands break the standard and use -long, but that's their own bug.


same for -help / --help. And there are the rogue commands that use -? and --help for the same...


Perhaps I don't understand what you are talking about. One hyphen for single-character combinable flags, and two hyphens for multi-character flags.


I'm happy I got to name the "say" tool in macOS X.

Internally we sometimes use a lower level tool for debugging TTS, which is called... "grunt".


Nothing make me feel more like a wizard while programming that rattling off some complex statements on the command line. Normally I don't use the cli a whole lot day-to-day but recently started on a project that has me using it a great deal. Overall the project has been pretty miserable but one of the bright spots has been getting much more competent with Linux commands.


Meta, but clicking on the article brings me to a page where I can’t read anything on the ledger iPhone — the top half is logo, ad and white space. The bottom half is covered by a huge cookie popup. And the bottom line is a floating chat button ️


imagine if Slack called itself webirc...

We'd all be better off, as we would know never to type that command.


What about `less` is `more`!?


"more" can't scroll upwards. "less" is a clone of more that can - hence the name.

In most unixes, more is now an alias to less, resulting in the literal fact that "less is more".


So now in order to transmit the mnemonic you have to communicate the lineage of the command. "more" begat "less" begat "zless"...

Punny names stop being funny after a few years. How about a general principle of not using punny names in the first place?


But it also doesn't matter. I still think of "nano" as "like pico", but I would bet at this point fewer than 10% of the people using nano today ever used pico or maybe ever heard of it. They just know the editor is named "nano" for whatever reason.

"elm" (ELectronic Mail) begat "pine" begat "pico" (PIne COmposer) begat "nano".


This isn't a problem unique to software. Half the stuff in the sciences is not named something useful and descriptive, but rather after whoever discovered it second. Naming things is hard.

"One of the miseries of life is that everybody names things a little bit wrong, and so it makes everything a little harder to understand in the world than it would be if it were named differently." --Richard Feynman


I think it's important to remember that unix-based operating systems are under your control. You can create aliases under any name you like, if you'd prefer a different name.


> unix-based operating systems are under your control

Except when they're not.


True, but if you can run any command, you can probably run the alias command. It's just more convenient if you can run it from a .bashrc or similar.


just as lovely as cat and tac


There's also a most(1) running around, though I couldn't tell you how it's different.


"Unlike other well-known paging programs most supports multiple windows and can scroll left and right. Why settle for less?" http://www.jedsoft.org/most/

It also has built in syntax highlighting. But it's not usable for me, as it doesn't have vi-like keybindings. My ideal pager would be less with syntax highlighting, which should be possible because git shows logs, etc in color in less when they're larger than a screen full… checks less manpage It is! You just need to use -r or -R and make sure commands you pipe into it don't disable color when they detect a pipe (eg. use ls --color, not ls --color=auto). Thanks for sending me down that rabbit hole!


i also love the posix c naming conventions, like fopen, malloc, iconv, the level of ambiguity and abstraction is poetic


creat() really gets me going


various 8bit '80s BASIC implementations:

REM

Yes, it's the comment marker, standing for REMARK.

But it's also, metaphorically, a line that is "asleep."

Genius.


I for one love pieces like this :-)


TFA lost me with the thing about curl. Yes, it's super easy to type, but it's a terrible UI.


You might like lftp.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: