ENV(1)

๐Ÿ’– NAME ๐Ÿ’–

okay so bestie, welcome to env(1) โ€” this is a User Commands page, and it's literally the girlboss of environment manipulation: run a program in a modified environment. that's the whole vibe. she sets your vars, she runs your program, she does NOT do small talk. ๐ŸŽ€


โœจ SYNOPSIS โœจ

env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

like. that's it. that's the shape of her. ๐Ÿ’…


๐ŸŒธ DESCRIPTION ๐ŸŒธ

the entire job description, no cap: Set each NAME to VALUE in the environment and run COMMAND. that's the assignment and she ate.

quick heads up that applies to literally every option below: mandatory arguments to long options are mandatory for short options too. so if a long one needs a value, the short one needs it too. don't fight it. ๐Ÿซถ

okay here's every single flag, bestie, all of them, in order:

  • -a, --argv0=ARG โ€” pass ARG as the zeroth argument of COMMAND. yes, the zeroth. the one before the first one. main character energy. ๐Ÿ‘‘
  • -i, --ignore-environment โ€” start with an empty environment. clean slate, blank canvas, fresh start, we love to see it โœจ
  • --env0-from=FILE โ€” read NUL-delimited environment entries from FILE. NUL-delimited, so mind your separators ๐Ÿฆ‹
  • -0, --null โ€” end each output line with NUL, not newline. for when newlines are simply not the moment ๐Ÿ’€
  • -u, --unset=NAME โ€” remove variable from the environment. gone. blocked. unfollowed. ๐Ÿ™ˆ
  • -C, --chdir=DIR โ€” change working directory to DIR. we're moving, bestie, pack your bags ๐Ÿงš
  • -S, --split-string=S โ€” process and split S into separate arguments; used to pass multiple arguments on shebang lines. she's the shebang whisperer fr fr ๐Ÿ’œ
  • --block-signal[=SIG] โ€” block delivery of SIG signal(s) to COMMAND
  • --default-signal[=SIG] โ€” reset handling of SIG signal(s) to the default
  • --ignore-signal[=SIG] โ€” set handling of SIG signal(s) to do nothing
  • --list-signal-handling โ€” list non default signal handling to standard error
  • -v, --debug โ€” print verbose information for each processing step. she's telling you everything, she's being so transparent ๐Ÿ”ฅ
  • --help โ€” display this help and exit
  • --version โ€” output version information and exit

and then the iconic little shortcut: a mere - implies -i. one dash, whole personality change. ๐Ÿ˜ญ

also: if no COMMAND, print the resulting environment. so if you just wanna see the env, she'll show you the env. no program, no problem.

one more thing about those signal options, listen up:

  • SIG may be a signal name like 'PIPE', or a signal number like '13'.
  • Without SIG, all known signals are included.
  • Multiple signals can be comma-separated.
  • An empty SIG argument is a no-op.

got it? got it. ๐Ÿ’–


โญ Exit status: โญ

the numbers that matter, and you WILL be checking these:

  • 125 โ€” if the env command itself fails
  • 126 โ€” if COMMAND is found but cannot be invoked
  • 127 โ€” if COMMAND cannot be found
  • - โ€” the exit status of COMMAND otherwise
127 is the "girl where are you" of exit codes. she looked. she did not find her. ๐Ÿ’€

๐Ÿฆ‹ SCRIPT OPTION HANDLING ๐Ÿฆ‹

okay this section is the reason -S exists and it's genuinely so useful, pay attention bestie.

the -S option allows specifying multiple arguments in a script. so say you've got a script named 1.pl and its first line is this:

#!/usr/bin/env -S perl -w -T
...

then she will execute perl -w -T 1.pl. periodt. that's the magic. โœจ

but WITHOUT the '-S' parameter? the script will likely fail, and it fails like this:

/usr/bin/env: 'perl -w -T': No such file or directory

because without -S she reads the whole thing 'perl -w -T' as ONE filename, and that filename is not real, and she is confused, and honestly same. ๐Ÿ˜ญ

See the full documentation for more details. there's more, go look, iykyk ๐ŸŒˆ


๐Ÿ’œ NOTES ๐Ÿ’œ

okay this one is important, it's a whole quote from POSIX's exec(3p) pages, and it's giving "we've all made mistakes":

"many existing applications wrongly assume that they start with certain signals set to the default action and/or unblocked.... Therefore, it is best not to block or ignore signals across execs without explicit reason to do so, and especially not to block signals across execs of arbitrary (not closely cooperating) programs."

translation: don't be out here messing with signal handling across exec for no reason, especially not into random programs that aren't in on the plan. that's the caution, and it's real. ๐ŸŽ€


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Written by Richard Mlynarik, David MacKenzie, and Assaf Gordon. legends, all three. bow down. ๐Ÿ’…


๐Ÿ“ REPORTING BUGS ๐Ÿ“

found a bug? tell the girlies, they wanna know:


Copyright ยฉ 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. like, none. zero. don't come for her. ๐Ÿ™ˆ

โœจ SEE ALSO โœจ

go read these next, they're the friend group:

Full documentation <https://www.gnu.org/software/coreutils/env> or available locally via: info '(coreutils) env invocation'


and that's the page, bestie!! ๐Ÿซถ this one's from GNU coreutils 9.12, dated September 2026 โ€” so if you're reading this, you're reading the freshest possible env(1), and honestly? she ate. go modify some environments. slay. ๐Ÿ’–๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from