Quickly become a different group in your shell to create or access group-owned resources. 07.12.2025 | reading time: 2 min When he needs to create or access files as a different group without logging out, he can use the newgrp command to start a shell with a new effective group ID so files inherit that group. A concrete scenario Imagine user alex is a member of the group dev but his current primary group is users; here is a session that shows the change and its effect: ``` $ id -gn users $ groups users dev $ newgrp dev $ id -gn dev $ touch project.txt $ ls -l project.txt -rw-r--r-- 1 alex dev 0 Oct 10 12:00 project.txt $ exit $ id -gn users ``` What actually happens newgrp launches a subshell with its effective group set to the named group (and the supplementary groups initialized from the account database); only the group identity changes, not the user ID, and when he exits that subshell the original group is restored. Practical caveats He must be a member of the target group or newgrp will fail, and adding him to a group in /etc/group usually requires re-login or running newgrp to take effect for a shell; remember that setgid directories and ACLs are alternate ways to grant group access without switching shells. Complementary commands For single commands with a group context he can use sudo or sg, for persistent directory behavior he can use the setgid bit or setfacl to manage group write access, and chgrp/chown change ownership when he has permission. Next steps Try adding the group, verifying membership with groups and id, and using newgrp to test file creation under the new group; to deepen Linux skills and prepare for certifications consider structured study and exam preparation at bitsandbytes.academy for CompTIA Linux+ or LPIC-1. Join Bits & Bytes Academy First class LINUX exam preparation. utilities filesystem security processes