The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

newgrp - Switching Groups




This command is related to user and group management. The newgrp command is similar to the login command in that it allows you to log in to another group with the same account. You can use the exit command to return to the original group.

Here's an operational example:
groups ←# List the groups the user is a member of
frank marketing ←The effective group is currently "frank" (listed first)
$ newgrp marketing ←Log in to the "marketing" group
groups ←Verify if you have logged in to the new group
marketing frank ←The effective group is now "marketing"
$ exit ←Return to the original group
groups ←Verify the groups again
frank marketing

For more explanations and examples related to the newgrp command, you can refer to the provided link.