{
    "content": [
        {
            "type": "text",
            "text": "# env (man)\n\n## NAME\n\nenv - run a program in a modified environment\n\n## SYNOPSIS\n\nenv [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n\n## DESCRIPTION\n\nSet each NAME to VALUE in the environment and run COMMAND.\n\n## TLDR\n\n> Show the environment or run a program in a modified environment.\n\n- Show the environment:\n  `env`\n- Run a program. Often used in scripts after the shebang (#!) for looking up the path to the program:\n  `env {{program}}`\n- Clear the environment and run a program:\n  `env {{-i|--ignore-environment}} {{program}}`\n- Remove variable from the environment and run a program:\n  `env {{-u|--unset}} {{variable}} {{program}}`\n- Set a variable and run a program:\n  `env {{variable}}={{value}} {{program}}`\n- Set one or more variables and run a program:\n  `env {{variable1=value variable2=value variable3=value ...}} {{program}}`\n- Run a program under a different name:\n  `env {{-a|--argv0}} {{custom_name}} {{program}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (8 subsections)\n- **OPTIONS** (2 subsections)\n- **NOTES**\n- **AUTHOR**\n- **REPORTING BUGS**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "env",
        "section": "",
        "mode": "man",
        "summary": "env - run a program in a modified environment",
        "synopsis": "env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]",
        "tldr_summary": "Show the environment or run a program in a modified environment.",
        "tldr_examples": [
            {
                "description": "Show the environment",
                "command": "env"
            },
            {
                "description": "Run a program. Often used in scripts after the shebang (#!) for looking up the path to the program",
                "command": "env {{program}}"
            },
            {
                "description": "Clear the environment and run a program",
                "command": "env {{-i|--ignore-environment}} {{program}}"
            },
            {
                "description": "Remove variable from the environment and run a program",
                "command": "env {{-u|--unset}} {{variable}} {{program}}"
            },
            {
                "description": "Set a variable and run a program",
                "command": "env {{variable}}={{value}} {{program}}"
            },
            {
                "description": "Set one or more variables and run a program",
                "command": "env {{variable1=value variable2=value variable3=value ...}} {{program}}"
            },
            {
                "description": "Run a program under a different name",
                "command": "env {{-a|--argv0}} {{custom_name}} {{program}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The -S option allows specifying multiple parameters in a script. Running a script named 1.pl containing the following first line: #!/usr/bin/env -S perl -w -T ... Will execute perl -w -T 1.pl . Without the '-S' parameter the script will likely fail with: /usr/bin/env: 'perl -w -T': No such file or directory See the full documentation for more details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option allows setting a signal handler to its default action, which is not possible us‐ ing the traditional shell trap command. The following example ensures that seq will be ter‐ minated by SIGPIPE no matter how this signal is being handled in the process invoking the command. sh -c 'env --default-signal=PIPE seq inf | head -n1'"
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "sigaction",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/sigaction/2/json"
            },
            {
                "name": "sigprocmask",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/sigprocmask/2/json"
            },
            {
                "name": "signal",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/signal/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": [
                    {
                        "name": "-i --ignore-environment",
                        "lines": 2,
                        "flag": "-i",
                        "long": "--ignore-environment"
                    },
                    {
                        "name": "-0 --null",
                        "lines": 2,
                        "flag": "-0",
                        "long": "--null"
                    },
                    {
                        "name": "-u --unset",
                        "lines": 2,
                        "flag": "-u",
                        "long": "--unset"
                    },
                    {
                        "name": "-C --chdir",
                        "lines": 2,
                        "flag": "-C",
                        "long": "--chdir"
                    },
                    {
                        "name": "-S --split-string",
                        "lines": 12,
                        "flag": "-S",
                        "long": "--split-string"
                    },
                    {
                        "name": "--list-signal-handling",
                        "lines": 2,
                        "long": "--list-signal-handling"
                    },
                    {
                        "name": "-v --debug",
                        "lines": 4,
                        "flag": "-v",
                        "long": "--debug"
                    },
                    {
                        "name": "--version",
                        "lines": 7,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-S/--split-string usage in scripts",
                        "lines": 14
                    },
                    {
                        "name": "--default-signal[=SIG] usage",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "env - run a program in a modified environment\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Set each NAME to VALUE in the environment and run COMMAND.\n\nMandatory arguments to long options are mandatory for short options too.\n",
                "subsections": [
                    {
                        "name": "-i --ignore-environment",
                        "content": "start with an empty environment\n",
                        "flag": "-i",
                        "long": "--ignore-environment"
                    },
                    {
                        "name": "-0 --null",
                        "content": "end each output line with NUL, not newline\n",
                        "flag": "-0",
                        "long": "--null"
                    },
                    {
                        "name": "-u --unset",
                        "content": "remove variable from the environment\n",
                        "flag": "-u",
                        "long": "--unset"
                    },
                    {
                        "name": "-C --chdir",
                        "content": "change working directory to DIR\n",
                        "flag": "-C",
                        "long": "--chdir"
                    },
                    {
                        "name": "-S --split-string",
                        "content": "process  and  split S into separate arguments; used to pass multiple arguments on she‐\nbang lines\n\n--block-signal[=SIG]\nblock delivery of SIG signal(s) to COMMAND\n\n--default-signal[=SIG]\nreset handling of SIG signal(s) to the default\n\n--ignore-signal[=SIG]\nset handling of SIG signals(s) to do nothing\n",
                        "flag": "-S",
                        "long": "--split-string"
                    },
                    {
                        "name": "--list-signal-handling",
                        "content": "list non default signal handling to stderr\n",
                        "long": "--list-signal-handling"
                    },
                    {
                        "name": "-v --debug",
                        "content": "print verbose information for each processing step\n\n--help display this help and exit\n",
                        "flag": "-v",
                        "long": "--debug"
                    },
                    {
                        "name": "--version",
                        "content": "output version information and exit\n\nA mere - implies -i.  If no COMMAND, print the resulting environment.\n\nSIG may be a signal name like 'PIPE', or a signal number like '13'.  Without SIG,  all  known\nsignals are included.  Multiple signals can be comma-separated.\n",
                        "long": "--version"
                    }
                ]
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-S/--split-string usage in scripts",
                        "content": "The -S option allows specifying multiple parameters in a script.  Running a script named 1.pl\ncontaining the following first line:\n\n#!/usr/bin/env -S perl -w -T\n...\n\nWill execute perl -w -T 1.pl .\n\nWithout the '-S' parameter the script will likely fail with:\n\n/usr/bin/env: 'perl -w -T': No such file or directory\n\nSee the full documentation for more details.\n"
                    },
                    {
                        "name": "--default-signal[=SIG] usage",
                        "content": "This option allows setting a signal handler to its default action, which is not possible  us‐\ning  the traditional shell trap command.  The following example ensures that seq will be ter‐\nminated by SIGPIPE no matter how this signal is being handled in  the  process  invoking  the\ncommand.\n\n\nsh -c 'env --default-signal=PIPE seq inf | head -n1'\n"
                    }
                ]
            },
            "NOTES": {
                "content": "POSIX's exec(2) pages says:\n\"many existing applications wrongly assume that they start with certain signals set to\nthe default action and/or unblocked.... Therefore, it is best not to block  or  ignore\nsignals  across  execs  without  explicit reason to do so, and especially not to block\nsignals across execs of arbitrary (not closely cooperating) programs.\"\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Written by Richard Mlynarik, David MacKenzie, and Assaf Gordon.\n",
                "subsections": []
            },
            "REPORTING BUGS": {
                "content": "GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright © 2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3  or  later\n<https://gnu.org/licenses/gpl.html>.\nThis  is free software: you are free to change and redistribute it.  There is NO WARRANTY, to\nthe extent permitted by law.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "sigaction(2), sigprocmask(2), signal(7)\n\nFull documentation <https://www.gnu.org/software/coreutils/env>\nor available locally via: info '(coreutils) env invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                      ENV(1)",
                "subsections": []
            }
        }
    }
}