# info > sg

---
type: CommandReference
command: sg
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `sg group command` — execute `command` as the specified group
- `sg - group` — start a login shell as the specified group
- `sg group -c "command"` — explicitly pass a command to `/bin/sh` (useful for multi-word commands)
- `sg - group -c "command"` — login shell + command as that group

## Name

`sg` — execute command as different group ID

## Synopsis

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

## Description

`sg` works similarly to `newgrp` but accepts a command. The command is executed with `/bin/sh`. Multi-word commands must be quoted. Unlike `newgrp`, `sg` does not replace the current shell; after the command exits, the user returns to the original group ID.

## Options

- `-` — start a login shell (similar to `newgrp -`)
- `-c` — specify the command to run (passed to `/bin/sh`)

## Configuration

- **`SYSLOG_SG_ENAB`** (boolean) — enable syslog logging of `sg` activity (defined in `/etc/login.defs`)

## Files

- `/etc/passwd` — user account information
- `/etc/shadow` — secure user account information
- `/etc/group` — group account information
- `/etc/gshadow` — secure group account information

## See Also

[id(1)](https://www.chedong.com/phpMan.php/man/id/1/markdown), [login(1)](https://www.chedong.com/phpMan.php/man/login/1/markdown), [newgrp(1)](https://www.chedong.com/phpMan.php/man/newgrp/1/markdown), [su(1)](https://www.chedong.com/phpMan.php/man/su/1/markdown), [gpasswd(1)](https://www.chedong.com/phpMan.php/man/gpasswd/1/markdown), [group(5)](https://www.chedong.com/phpMan.php/man/group/5/markdown), [gshadow(5)](https://www.chedong.com/phpMan.php/man/gshadow/5/markdown)