newgrp

Linux · Users and permissions · reference only

What it does

Changes the current session's primary group to another group you already belong to, opening a new shell.

Syntax

newgrp [-] [grupo]

Options and parameters

  • grupo

    Group to switch to; you must be a member or know its password.

  • -

    Resets the environment as in a fresh login.

  • (sin argumentos)

    Goes back to the primary group listed in /etc/passwd.

Usage examples

  • newgrp devs

    Files you create from now on will belong to the devs group.

  • id -gn

    Shows the active primary group to check the change.

  • newgrp

    Returns to your account's original primary group.

Notes and common mistakes

  • It opens a new shell: leave with exit to return to the previous one.
  • It is the way to apply a membership just added with gpasswd without logging out.

Related commands