HACKER Q&A
📣 booboofixer

Why are there so few single-letter command line utilities / tools?


Is there a reason for so few single-letter command line utilities? On my macOS, running

  for char in {A..z}; do type "$char" 2>/dev/null; done
gives the following

A not found B not found C not found D not found E not found F not found G not found H not found I not found J not found K not found L not found M not found N not found O not found P not found Q not found R not found S not found T not found U not found V not found W is /usr/bin/W X not found Y not found Z not found [ is a shell builtin \ not found ] not found ^ not found _ not found ` not found a not found b not found c not found d not found e not found f not found g not found h not found i not found j not found k not found l not found m not found n not found o not found p not found q not found r is a shell builtin s not found t not found u not found v not found w is /usr/bin/w x not found y not found z not found

Single letters are so much easier to type than any other number of letters. Curious if perhaps this was not allowed or was not possible for some reason in the earlier unix / linux days?


  👤 sonofhans Accepted Answer ✓
I design a lot of CLIs, and I wonder this, too. I think it's two things. First, it's very hard to attach meaning to a single character. Many early Unix tools were two-character, which is just enough to remember and to be unique.

Second, many (not all!) Unix people have been reluctant to pollute global namespaces. Anyone building a CLI tool for the use of others knows that it's going into a complex environment with many other tools. If it become commonplace to create single-letter tools than there would be constant conflict in that namespace.

In my experience, groups of geeks are often aware of the tragedy of the commons, and able to act in concert against it.


👤 TeaVMFan
Because they're impossible to search for.

Tried researching a tool called 'a' once. Good tool, but hard to find docs.


👤 klysm
It’s a small namespace, bad idea to pick something from a small occupied by everybody else making things too in the future and unbeknownst to you from the past

👤 cyberge99
I think a lot of people may use aliases invoked by a single letter. They’re very specific to each persons workflow, habits, etc.

👤 pkrotich
I guess you haven't received a lecture yet on naming programs or functions - here it goes - a) choose a word with meaning, b) avoid generic names and c) don't make your names too long or too short.

I'm obviously being sarcastic - but on a serious note, that's what aliasing is for - e.g "alias l='ls -lah'"


👤 goodside
Please appreciate you’ve just included a stderr paste enumerating all the letters of the alphabet in a question asking why anyone would use two letters when one would do.

👤 R0b0t1
No one has the requisite hubris to seize a letter.

👤 dredmorbius
For the "why":

- The namespace is small. Appropriating it for a specific command might well prove inconvenient later.

- Critical commands in a single character could lead to ... undesired consequences. There's already sufficient risk with two- and three-letter commands.

- Many commands are short, though 2--4 characters rather than 1.

And finally: there are more single-letter commands than your one-liner would suggest.

I think 'a' was the assembler on some systems.

'R' is a statistical application. It is the successor to 'S'

'X' is the X11 windowing system. It is the successor to 'W'. Not to be confused with 'w'.

There are the A, B, C, and D programming languages, at a minimum. As others have noted, searching for them specifically (amongst other commands) is ... something of a pain.


👤 sh4un
Fat fingering could be fatal.

👤 ggm
Please close this thread on 26 responses

👤 Flankk
Letters hold no meaning. The ls, mv, cp, rm commands are self-explanatory with only one extra letter.

👤 jaclaz
In the (good ol') times of DOS, Qedit: https://en.wikipedia.org/wiki/The_SemWare_Editor#Qedit was an almost ubiquitous text editor, the actual program was named q.exe, invoked by simply "q".

👤 smoldesu
If it really bothers you, it's easy enough to alias those letters to the commands that you do want, which is probably better for flexibility and whatnot. Adding in single-letter commands would probably be too hard to remember for most people.

👤 peterkos
What I can say is that it lets me have a lot of convenient aliases for things that are 1 letter long: “o” for “open .”, “s” for “subl .”, etc. And nice 2 letter ones: “gc” for “git commit”.

👤 daveidol
Check out “z” - I use it all the time: https://github.com/rupa/z

👤 beardyw
Let's put a positive spin on it. You can safely use all 26 to assign to your favourite commands.

👤 112
It's for the best, you can use them as names for your own stuff.

👤 jareklupinski
just a thought, maybe with early languages already taking up A, B, and C, folks thought of single letters as language domains?

>"just use C" <"the program or the language?"


👤 klyrs
Single letters are reserved for variable names?

👤 clavicat
I’ve always found the Unix preference for concision over descriptive and intuitive commands to be stupid. Even they feel that one-letter commands are too short—two letters are not much better.