How to install "tfenv" Terraform version manager on Ubuntu OS


tfenv - is an open-source Terraform version manager tool. With this tool, you can easily install any required version of Terraform on your system and switch to other versions if needed.

Ubuntu 20.04


  1. Clone source files into ~/.tfenv:
    git clone ~/.tfenv
  2. Add ~/.tfenv/bin to your $PATH:
    echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile
  3. Create symlink to the executable:
    sudo ln -s ~/.tfenv/bin/* /usr/local/bin


  1. To get installed version:
    tfenv --version
  2. To get list of all available commands:
  3. To list all installed versions:
    tfenv list
  4. To list all installable versions from remote repositories:
    tfenv list-remote
  5. To install a specific version of Terraform use:
    tfenv install [version]
  6. To uninstall a specific version use:
    tfenv uninstall [version]
  7. To switch to a specific version use:
    tfenv use [version]
  8. To write the current active version to ./.terraform-version use:
    tfenv pin


  1. Delete entry from ~/.bash_profile file:
    grep -v 'export PATH="$HOME/.tfenv/bin:$PATH"' ~/.bash_profile > ~/.bash_profile_tmp && mv ~/.bash_profile_tmp ~/.bash_profile
  2. Unlink symlink:
    sudo unlink /usr/local/bin/tfenv
  3. Delete ~/.tfenv folder:
    rm -rf ~/.tfenv/


  1. .terraform-version
  2. Delete Lines in a Text File That Contain a Specific String