Home Environment Variables in Linux
Post
Cancel

Environment Variables in Linux

Linux Environment variable is a dynamic-named value, which may be used by one or more programs running. It can also be defined as a set of Rules and Values to build an environment.

Syntax: VARIABLE_NAME=VALUE

How to view Environment Variables?

  • To view all the environment variables

    Syntax: #printenv or env

  • To view only one environment variable

    Syntax: #echo $variable_name

How to set Environment Variables?

  • To set the environment variable temporary

    Syntax: export TESTVAR=1

  • To set the environment variable permanently
    • First open up the .bashrc file
    • set the Environment variable
    • run source .bashrc
This post is licensed under CC BY 4.0 by the author.