SG(1)

๐Ÿ’– SG(1) โ€” the sg girlies' manual ๐Ÿ’–

okay so bestie, welcome to the sg page โœจ this is a User Command, and honestly? it's giving "group ID glow-up" and I'm obsessed ๐ŸŽ€


โœจ NAME โœจ

sg โ€” execute command as a different group ID ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

sg [-] group [[-c] command]

๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so here's the tea ๐Ÿ“: the sg command is lowkey the same vibe as newgrp, except โ€” and this is the iconic part โ€” it actually accepts a command. slay.

That command gets executed with the /bin/sh shell, no cap. And here's the thing bestie: with most shells you might be running sg from, you have to wrap multi-word commands in quotes. literally just do it, it's not optional, it's the vibe. ๐Ÿ™ˆ

Another difference between newgrp and sg? okay so some shells treat newgrp specially โ€” they replace themselves with a whole new instance of a shell that newgrp creates. main character energy fr. That does NOT happen with sg, so when you exit from an sg command, you're returned to your previous group ID. no drama, no lingering, we go back to how it was. periodt. ๐Ÿ‘‘


๐Ÿ’… OPTIONS ๐Ÿ’…

the options that apply to the sg command are, bestie:

  • -, -l โ€” start the shell as a login shell. yes queen, log in properly ๐ŸŒˆ
  • -c โ€” specify a command that will be invoked by the shell using its -c.

this one is the default; it's there for backward compatibility. so it's not doing the most, but it's holding it down for the old-school crew ๐Ÿซถ


๐ŸŽ€ CONFIGURATION ๐ŸŽ€

the following configuration variables in /etc/login.defs change the behavior of this tool:

  • SYSLOG_SG_ENAB (boolean) โ€” enable "syslog" logging of sg activity. so like, your sg doings get logged. iykyk ๐Ÿ“

๐Ÿงš FILES ๐Ÿงš

  • /etc/passwd โ€” user account information. the basics ๐Ÿ’–
  • /etc/shadow โ€” secure user account information. the secretive one, we love a mystery ๐Ÿ’€
  • /etc/group โ€” group account information. group chat energy fr fr ๐Ÿ‘‘
  • /etc/gshadow โ€” secure group account information. the locked group chat, private mode on ๐Ÿ”ฅ

โญ SEE ALSO โญ

id(1), login(1), newgrp(1), su(1), gpasswd(1), group(5), gshadow(5).

go read those too, bestie, they're all part of the lore ๐ŸŒˆ


and that's the whole page!! this one came from shadow-utils 4.19.0, dated 04/29/2026 โ€” so yeah, fresh, iconic, exactly the version you're holding. mwah ๐Ÿ’‹ ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from