{
    "content": [
        {
            "type": "text",
            "text": "# setsid (man)\n\n## NAME\n\nsetsid - run a program in a new session\n\n## SYNOPSIS\n\nsetsid [options] program [arguments]\n\n## DESCRIPTION\n\nsetsid runs a program in a new session. The command calls fork(2) if already a process group\nleader. Otherwise, it executes a program in the current process. This default behavior is\npossible to override by the --fork option.\n\n## TLDR\n\n> Run a program in a new session if the calling process is not a process group leader.\n\n- Run a program in a new session:\n  `setsid {{program}}`\n- Run a program in a new session discarding the resulting output and error:\n  `setsid {{program}} > /dev/null 2>&1`\n- Run a program creating a new process:\n  `setsid {{-f|--fork}} {{program}}`\n- Return the exit code of a program as the exit code of setsid when the program exits:\n  `setsid {{-w|--wait}} {{program}}`\n- Run a program in a new session setting the current terminal as the controlling terminal:\n  `setsid {{-c|--ctty}} {{program}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (5 subsections)\n- **AUTHORS**\n- **SEE ALSO**\n- **REPORTING BUGS**\n- **AVAILABILITY**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "setsid",
        "section": "",
        "mode": "man",
        "summary": "setsid - run a program in a new session",
        "synopsis": "setsid [options] program [arguments]",
        "tldr_summary": "Run a program in a new session if the calling process is not a process group leader.",
        "tldr_examples": [
            {
                "description": "Run a program in a new session",
                "command": "setsid {{program}}"
            },
            {
                "description": "Run a program in a new session discarding the resulting output and error",
                "command": "setsid {{program}} > /dev/null 2>&1"
            },
            {
                "description": "Run a program creating a new process",
                "command": "setsid {{-f|--fork}} {{program}}"
            },
            {
                "description": "Return the exit code of a program as the exit code of setsid when the program exits",
                "command": "setsid {{-w|--wait}} {{program}}"
            },
            {
                "description": "Run a program in a new session setting the current terminal as the controlling terminal",
                "command": "setsid {{-c|--ctty}} {{program}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-c",
                "long": "--ctty",
                "arg": null,
                "description": "Set the controlling terminal to the current one."
            },
            {
                "flag": "-f",
                "long": "--fork",
                "arg": null,
                "description": "Always create a new process."
            },
            {
                "flag": "-w",
                "long": "--wait",
                "arg": null,
                "description": "Wait for the execution of the program to end, and return the exit status of this program as the exit status of setsid."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "Display version information and exit."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Display help text and exit."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-c --ctty",
                        "lines": 2,
                        "flag": "-c",
                        "long": "--ctty"
                    },
                    {
                        "name": "-f --fork",
                        "lines": 2,
                        "flag": "-f",
                        "long": "--fork"
                    },
                    {
                        "name": "-w --wait",
                        "lines": 3,
                        "flag": "-w",
                        "long": "--wait"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "setsid - run a program in a new session\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "setsid [options] program [arguments]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "setsid runs a program in a new session. The command calls fork(2) if already a process group\nleader. Otherwise, it executes a program in the current process. This default behavior is\npossible to override by the --fork option.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-c --ctty",
                        "content": "Set the controlling terminal to the current one.\n",
                        "flag": "-c",
                        "long": "--ctty"
                    },
                    {
                        "name": "-f --fork",
                        "content": "Always create a new process.\n",
                        "flag": "-f",
                        "long": "--fork"
                    },
                    {
                        "name": "-w --wait",
                        "content": "Wait for the execution of the program to end, and return the exit status of this program\nas the exit status of setsid.\n",
                        "flag": "-w",
                        "long": "--wait"
                    },
                    {
                        "name": "-V --version",
                        "content": "Display version information and exit.\n",
                        "flag": "-V",
                        "long": "--version"
                    },
                    {
                        "name": "-h --help",
                        "content": "Display help text and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    }
                ]
            },
            "AUTHORS": {
                "content": "Rick Sladkey <jrs@world.std.com>\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "setsid(2)\n",
                "subsections": []
            },
            "REPORTING BUGS": {
                "content": "For bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n",
                "subsections": []
            },
            "AVAILABILITY": {
                "content": "The setsid command is part of the util-linux package which can be downloaded from Linux\nKernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                                    SETSID(1)",
                "subsections": []
            }
        }
    }
}