newgrp

Official Description

Changes the primary group identification of a shell process.

Syntax

newgrp  [group]

Options

None

Oddities

The C shell has its own version of this command.

Example

$ grep obrien /etc/group
users:x:100:obrien
obrien:x:500:
$
$ id
uid=500(obrien) gid=500(obrien) groups=500(obrien)
$
$ newgrp users               # Change primary group
$
$ id
uid=500(obrien) gid=100(users) groups=500(obrien)
$
				

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.