Ask HN: Why are there so few single-letter command line utilities / tools?
for char in {A..z}; do type "$char" 2>/dev/null; done
gives the followingA 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?
44 comments
[ 4.6 ms ] story [ 103 ms ] threadThey really aren't :)
If you came across them outside of the context in which you learned them, they mean nothing.
Once you've learned them, only then do you know that they are contractions/abbreviations: ls is list, mv is move, cp is copy etc.
Now I have them internalised, so it's fine.
The issue there is that's dangerously close to 'rm'! I'll stick to 'mv' thanks.
https://www.tutorialspoint.com/jcl/jcl_dd_statement.htm
Quick shoutout, you should probably alias to 'du -sh -- *'. Otherwise file names starting with '-' are interpreted as input for your command.
While they arent a single char I do like these a lot:
gs='git status'
gl='git pull'
gcm='git commit -m'
ga='git add -A'
gp='git push'
Tried researching a tool called 'a' once. Good tool, but hard to find docs.
I'm obviously being sarcastic - but on a serious note, that's what aliasing is for - e.g "alias l='ls -lah'"
>"just use C" <"the program or the language?"
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.
Nobody I know in my cohort/age-group thinks capital letters make a different command. Lots of us inherited a memetic state of alias/function to make a single "l" do some variant of the ls command. And "m" for more was not uncommon. "p" to pass to the large for some, never bothered me much to type more letters.
Other than that, the "w" and . Are about it. . As an execution invitation feels less like a command than just syntactic suger.
(As does the cryptic :> to zero instantiate a file)
- 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.