Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What does the -c option of sg do? At least on my machine, the man page fails to explain this option.

share|improve this question
up vote 3 down vote accepted

It's not documented in the man page, but looking at the source code it looks like it runs the command via "/bin/sh -c" instead of executing it directly. I think it is there mostly for compatibility with the sg command on other Unix systems.

share|improve this answer


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


    The sg command works similar to newgrp but accepts a command.
    The command will be executed with the /bin/sh shell.

As you can see, sg accepts a command after the -c switch ( we can tell that by looking at the synopsis ) which will be executed using /bin/sh shell.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.