The newgrp command

Posted on Mon 20 July 2020 in dev-journal

newgrp is a convienient command I ran across today. You can run this command after you add your user to a group. This allows you to continue without having to logout and log back in for the group changes to take effect.

Here is the man page:

 Manual page newgrp(1) line 1/28 (END) (press h for help or q to quit)...skipping...
NEWGRP(1)                                                                                                                                                                           User Commands                                                                                                                                                                           NEWGRP(1)

NAME
       newgrp - log in to a new group

SYNOPSIS
       newgrp [group]

DESCRIPTION
       newgrp changes the group identification of its caller, analogously to login(1).  The same person remains logged in, and the current directory is unchanged, but calculations of access permissions to files are performed with respect to the new group ID.

       If no group is specified, the GID is changed to the login GID.

FILES
       /etc/group
       /etc/passwd

SEE ALSO
       login(1), group(5)

AUTHOR
       Originally by Michael Haardt. Currently maintained by Peter Orbaek (poe@daimi.aau.dk).

AVAILABILITY
       The newgrp command is part of the util-linux package and is available from https://www.kernel.org/pub/linux/utils/util-linux/.

util-linux