How To Install Envsubst?

How To Install Envsubst?

envsubst

Substitutes shell format strings with environment variables in text.
Strings to be replaced should be in either `${var}` or `$var` format.

Maintainer: Santiago Vila



Section: utils

Install envsubst

  • Debian apt-get install gettext-base Click to copy
  • Ubuntu apt-get install gettext-base Click to copy
  • Alpine OS apk add gettext Click to copy
  • Arch Linux pacman -S gettext Click to copy
  • Kali Linux apt-get install gettext-base Click to copy
  • CentOS yum install gettext Click to copy
  • Fedora dnf install gettext Click to copy
  • Raspbian apt-get install gettext-base Click to copy
  • macOS brew install gettext Click to copy

Substitutes shell format strings with environment variables in text. Strings to be replaced should be in either `${var}` or `$var` format.

How to use envsubst?

Below are few example commands for envsubst that you can use in the terminal.

Replace environment variables in stdin and output to stdout:
echo '$HOME' | envsubstClick to copy
Replace environment variables in an input file and output to stdout:
envsubst < path/to/inputClick to copy
Replace environment variables in an input file and output to a file:
envsubst < path/to/input > path/to/outputClick to copy
Replace environment variables in input from a space-separated list:
envsubst variables < path/to/inputClick to copy
Installing envsubst command is simple. just copy one of the above commands for your operating system and paste it into terminal. This command is available for Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian and macOS operating systems. Once you run the command it will install the latest version of envsubst 2026 package in your OS.