Interview Prep/Linux/Permissions, Users & sudo

What does `newgrp` and `sg` do?

IntermediateConceptPermissions, Users & sudo
Answer

newgrp docker starts a new shell with docker as the primary group, so a just-added group membership takes effect without logging out. sg docker -c 'docker ps' runs a single command with that group. Both just read current /etc/group membership.

All Linux questions Roadmap: Linux

More on Permissions, Users & sudo