newgrp — change primary group for a command


newgrp [-] [group] [command [args...] ]


newgrp changes the primary group for a command.

If the - flag is given as first argument, the user's environment will be reinitialized as though the user had logged in, otherwise the current environment, including current working directory, remains unchanged.

newgrp changes the current primary group to the named group, or to the default group listed in /etc/passwd if no group name is given.

By default, the user's standard shell is started, called as login shell if the - flag has been specified. If a group has been given as argument, a command and its arguments can be specified on the command line.

The new primary group must be either the old primary group, or it must be part of the supplementary group list. Setting the primary group to an arbitrary group is not allowed in Windows.

See also

id(1), login(1).