Why the Unix newgrp command exists (sort of)
utcc.utoronto.ca
utcc.utoronto.ca
I forget the exact reason for the limit of 16, but I think it was an NFS limit.
This is a limitation of NFS, or more specifically AUTH_SYS per RFC 5531 (§A):
* https://tools.ietf.org/html/rfc5531#page-25
A lot (most?) NFS appliances tend to have a setting where you can tell them to ignore the group list that comes in on the RPC call and just do a look-up on the UID themselves: this way they get the full list via LDAP/NIS/AD/whatever and then do permission checks from that.
Try these commands:
id
touch a
newgrp cdrom # or any group other than the first one
id # note that gid is now 'cdrom',
# and it's also first on the groups= list
touch b
ls -l a b # note different group ownership
exit # leave the extra shell that newgrp created
This can actually save steps if the gid of newly-created files matters because it can avoid an extra chgrp command (which saves typing and avoids a little I/O).https://news.ycombinator.com/item?id=24740860
Funny story:
I worked with some sales people in a pre-sales role. This came up during prep for a presentation. A couple of us were on the command line on the projector. There was the usual chatter about getting the magic incantations right, and how come nothing is fully spelled out, etc...
Two of the women on the team brought up middle school notes and how they would often leave a lot out.
When people are familiar, there is a shared mini culture in play. Slang, common expression.
They would use first letters only, with the odd fully spelled out words here and there. Sort of a game, how well do you know your friends?
"Haven't you ever done that?"
"Of course not."
"Yeah, boys."
"It's fun"
And of course we started to play this silly game at work.
NH!
BRT
TY
YAW
YATB!
Soon, paragraphs became sentences.
Turns out a whole lot can be said this way and how well it is received is a direct function of how closely anyone reading are to the people exchanging the messages.
And it worked. Anyone playing got a lot closer to others also playing.
A fun friendship lark.
All that *nix stuff works the same way. Culture, familiarity...
Never thought about it that way myself, until that workplace word play happened.
There is this too:
https://www.snopes.com/fact-check/can-you-raed-tihs/
The same sort of mapping to meaning seems to happen with shortened commands. It is all just lean in a way that means less work for basically the same outcome.
Frankly, I always found the mnemonic association helpful. My mind fills in the blanks, which helps with memory.
Also typing. It is nice to type less.
Every time I abbreviate something on mobile, I see the next character after a space go to capitalized mode and wonder how anyone expected the parser to differentiate that from end of sentence.
Reads fine, but input is broken now...
>Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e."
There was definitely a mentality at this time that symbols should be short. Probably partly because of the low resolution terminals of the time, and especially teletypes but also maybe because of different practices and a different ecosystem. That's how we ended up with /usr instead of /user and /mnt instead of /mount.
Home directories were originally stored in /usr, as are another user programs
“ In particular, in our own version of the system, there is a directory "/usr" which contains all user's directories, and which is stored on a relatively large, but slow moving head disk, while the othe files are on the fast but small fixed-head disk. “
So we get fcntl and ioctl -- two different shortenings of `control` !
And then many Unix shell utilities are themselves counterparts of the corresponding C APIs - e.g. "chown". It stands to reason that they'd have identical names; but in doing so, they would also set a precedent for that kind of shortening in general. So if you already have "chown", then why not "chgrp"? And if you have "chgrp", then you'd probably want "newgrp" rather than "newgroup".
This was 20ish years ago, so I have no idea what the behavior of now.
But it gets even better ... I also had admin access to many databases. :)