Live data from Hacker News

Why the Unix newgrp command exists (sort of)

utcc.utoronto.ca

11–20 of 35 posts

Re: Why the Unix newgrp command exists (sort of)

#11
The newgrp command also changes your primary group. This affects the gid on new files that get created (a field in the new file's inode).

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).

Re: Why the Unix newgrp command exists (sort of)

#12

The real question is: why not just suck it up and include that "ou"?

Your comment reminded me of the classic Ken Thompson quote:

>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.

Re: Why the Unix newgrp command exists (sort of)

#13

At a previous job, I had to use newgrp quite frequently. There's a limit on the number of "active" groups you can be in at a time, typically 16. Groups were used for permissions for directories on network storage and our version control system at the time. As far as I'm aware, I was the only person at the company affected because I touched so many different repositories, I was a member of around 20 groups. I had to b…

> There's a limit on the number of "active" groups you can be in at a time, typically 16. Groups were used for permissions for directories on network storage and our version control system at the time. 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 grou…

The limit exists on some Unixen as well natively (e.g., Solaris), but yes, it's likely most often experienced as an NFS behaviour.

Re: Why the Unix newgrp command exists (sort of)

#14
post #4
post #3

Earlier quoted context omitted.

Because the nubs of it matter. The "ou" does not.

Wait, nly th nbs f t mtter?

Y

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.

Re: Why the Unix newgrp command exists (sort of)

#15
post #3

Earlier quoted context omitted.

Because the nubs of it matter. The "ou" does not.

*nix people are funny

Indeed. Think lean.

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.

Re: Why the Unix newgrp command exists (sort of)

#16
post #3

Earlier quoted context omitted.

Because the nubs of it matter. The "ou" does not.

*nix people are funny

I find the move to make one space after a period equally funny, BTW.

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...

Re: Why the Unix newgrp command exists (sort of)

#17

The newgrp command also changes your primary group. This affects the gid on new files that get created (a field in the new file's inode). 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 sav…

It could also eliminate a race condition.

Re: Why the Unix newgrp command exists (sort of)

#18
Fun anecdote about Unix groups: when I worked at Netscape, managers were shocked to discover that I was in both the frontend and backend groups, against the policy of allowing one person to take over the web site. (I worked on both sides, so had been granted access to do my work.)

But it gets even better ... I also had admin access to many databases. :)

Re: Why the Unix newgrp command exists (sort of)

#19

The newgrp command also changes your primary group. This affects the gid on new files that get created (a field in the new file's inode). 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 sav…

It could also eliminate a race condition.

Good point. I hadn't thought about that. With careful use of umask, chgrp, and chmod (in that order and with proper error handling), you could protect yourself, but just setting it to the right value in the first place seems simpler.

Re: Why the Unix newgrp command exists (sort of)

#20
post #12

The real question is: why not just suck it up and include that "ou"?

Your comment reminded me of the classic Ken Thompson quote: >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…

usr stands for UNIX system resources
Post reply on HN