envz_add - Linux


envz_add allows you to create or modify values in the environment variable zone (zfs property named environment).


envz_add [-g] [-A] [-E] [-H] [-L] [-n] [-o] [-R] [-S] [-t] [-u] -z <zone> <value> <name>


  • -g: Global. Sets the environment variable globally (outside of any dataset).
  • -A: Append. Appends the value to the end of the existing value.
  • -E: Export. Exports the environment variable so it can be inherited by child processes.
  • -H: Hide. Hides the environment variable from env(1) and printenv(1).
  • -L: Local. Sets the environment variable locally (inside the dataset).
  • -n: NoMerge. Skips merging the new value with the existing value.
  • -o: Overwrite. Overwrites the existing value with the new value.
  • -R: Regex. Treats the value as a regular expression.
  • -S: Silent. Suppresses all output.
  • -t: Transient. Sets the environment variable transiently (only for the current process).
  • -u: Unset. Unsets the environment variable.
  • -z : The zone name of the ZFS dataset where the environment variable will be set.


Set a global environment variable:

# envz_add -g FOO bar

Append to an existing environment variable:

# envz_add -A FOO ", baz"

Create a local environment variable within a dataset:

# envz_add -L FOO bar my-dataset

Unset an environment variable:

# envz_add -u FOO my-dataset

Set a hidden environment variable that won’t be printed by env:

# envz_add -H FOO my-password my-dataset

Common Issues

Error: envz_add: invalid dataset

Solution: Ensure that the dataset specified in the -z option exists.


With zfs(1):

# zfs set enviroment=FOO=bar my-dataset

With printenv(1):

# printenv FOO

Related Commands

  • zfs(1) – The ZFS file system manager.
  • setenv(1) – Sets an environment variable in the current shell.