10 ms·
The Poetics of CLI Command Names
- nixpulvis 6y agoWhat about `less` is `more`!?
- LeoPanthera 6y ago"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".
- rabidrat 6y agoSo 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?
- LeoPanthera 6y agoI 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.
- reificator 6y ago> unix-based operating systems are under your control Except when they're not.
- boogies 6y agoTrue, 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.
- acheron 6y agoBut 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".
- dTal 6y agoThis 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
- jnxx 6y agojust as lovely as cat and tac
- yjftsjthsd-h 6y agoThere's also a most(1) running around, though I couldn't tell you how it's different.
- boogies 6y ago"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/ 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!
- karatestomp 6y agoTo `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"?
- logicprog 6y agoYou win HN for the day imo!
- CSSer 6y agoI concur, bravo! Someone should enshrine this comment somewhere. Sometimes I wish hacker news had a “best of”.
- logicprog 6y agoThat would be fun. Someone clearly disagreed with me though, for I have one downvote now? Lol.
- CSSer 6y agoHhhmm, 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. ¯\_(ツ)_/¯
- gumby 6y agoIt does contribute though. I have to type ‘man’ every time I want to add a user to decide which. It’s a great lesson.
- adiM 6y ago> 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?
- senorprogrammer 6y agoThe author is making a joke about ‘gnu’.
- frank2 6y agoI 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.
- LeoPanthera 6y agoYou used to be able to chose the prefix, until Homebrew removed build options. (You still can on the BSDs.)
- skissane 6y agoNot 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.
- shitloadofbooks 6y agoSay 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/developer/cmdlet/approved-verbs-for-windows-powershell-commands https://docs.microsoft.com/en-us/powershell/scripting/develo...
- LeonB 6y agoAs 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.
- logicprog 6y agoAll those capital letters seem annoying to type to me, though. Is PowerShell case-insensitive?
- soheilpro 6y agoYes.
- colejohnson66 6y agoIsn’t that due to Windows (and NTFS (by default)) being case insensitive?
- soheilpro 6y agoNo. PowerShell commands are not necessarily stored on disk.
- tuatoru 6y agoDiscoverable? 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.
- deleted 6y ago[deleted]
- hirundo 6y ago"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.
- batman-farts 6y agoimagine if Slack called itself webirc... We'd all be better off, as we would know never to type that command.
- slmjkdbtl 6y agoi also love the posix c naming conventions, like fopen, malloc, iconv, the level of ambiguity and abstraction is poetic
- rabidrat 6y agocreat() really gets me going
- skissane 6y agoOS/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.)
- beart 6y agoIs this where powershell got it from?
- skissane 6y agoI 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.)
- rdhatt 6y agoHere's a primary source: https://devblogs.microsoft.com/powershell/verb-noun-vs-noun-verb/ https://devblogs.microsoft.com/powershell/verb-noun-vs-noun-...
- tuatoru 6y agoI 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.
- egypturnash 6y agoYggdrasil 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...
- Y_Y 6y agoIt would probably get confused with Yggdrasil, the hot new "Linux distribution" that everyone is trying.
- elcomet 6y agofrom wikipedia: "The last release of Yggdrasil was in 1995."
- egypturnash 6y agoWhy is this giving me flashbacks to the time around then when a friend tried downloading Slackware to some insane number of floppy disks.
- microtherion 6y agoAs 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…
- dhosek 6y agoThe 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).
- microtherion 6y ago
- cryptonector 6y agoTFA lost me with the thing about curl. Yes, it's super easy to type, but it's a terrible UI.
- jnxx 6y agoYou might like lftp.
- divbzero 6y agoTIL: “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!
- PostPlummer 6y agoIf we could just get a standard for -? or /? or --? I would be happy already.
- chuchurocka 6y agosame for -help / --help. And there are the rogue commands that use -? and --help for the same...
- jooize 6y agoPerhaps I don't understand what you are talking about. One hyphen for single-character combinable flags, and two hyphens for multi-character flags.
- yjftsjthsd-h 6y agoWe 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.
- puszczyk 6y agoMeta, 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 ️
- cjcampbell 6y agoWatching 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`.
- interfixus 6y ago>> 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.
- scbrg 6y ago> 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).
- jspaetzel 6y agoVersions should appear when you have multiple versions, not a default behavior.
- scbrg 6y agoI'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?
- yjftsjthsd-h 6y agoNo, you use your package manager's alternatives system to manage who gets the "default" name.
- scbrg 6y agoYes, 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.
- RoutinePlayer 6y agoI for one love pieces like this :-)
- microtherion 6y agoI'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".
- rurp 6y agoNothing 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.
- rchase 6y agovarious 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.