Home   |   Guides and Tutorials   |   What's New?   |   Comments   |   About
 

newgrp: Changing to Another User Group

by Tammy Fox
Last Modified: Wednesday, 19-May-2004 11:55:35 EDT

Introduction
    newgrp is a command that allows you to change the group you are currently a member of. It allows you to be be a member of more than one group and switch groups by executing the newgrp command.

Using newgrp
    Most users are by default in the users group. However, if you have permission to be a member of more than one group, you can use the newgrp command to switch between different groups. To view the current group of a file, execute the following command:
ls -l.
This will display the files in the current directory in long format. The fourth column in the table is the group that the file/directory is associated with. For further information on reading permissions, see the Reading Files/Directories Permissions guide. For further information on adding a new group, see the groupadd: Adding a New User Group guide.
    To use the command, type newgrp groupname (where "groupname" is the new group you wish to change to) If you have permission to be a member of that group, all your actions from then on will have the permissions of that new group. For example, if you create a new file or directory, the group of the new file or directory will be "groupname".

What's Related


All Rights Reserved Linux Headquarters © 2000-2007
Linux is a registered trademark of Linus Torvalds
All logos are registered trademarks of their respective owners
Last modified: Wednesday, May 19, 2004