An environment variable is a variable whose value is set outside the program, typically through functionality built into the operating system or micro-service. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.
Example of environment variable:
$USER: Gives current user's name.
$PATH: Gives search path for commands.
$PWD: Gives the path of present working directory.
$HOME: Gives path of home directory.
$HOSTNAME: Gives name of the host.
$LANG: Gives the default system language.
$EDITOR: Gives default file editor.
$UID: Gives user ID of current user.
$SHELL: Gives location of current user's shell program.
To see all environment variables:
env
or
printenv
You will find a list of environment variables as below:
SHELL=/bin/bash SESSION_MANAGER=local/saidul-Inspiron-5502:@/tmp/.ICE-unix/3901,unix/saidul-Inspiron-5502:/tmp/.ICE-unix/3901 QT_ACCESSIBILITY=1 COLORTERM=truecolor XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg XDG_MENU_PREFIX=gnome- GNOME_DESKTOP_SESSION_ID=this-is-deprecated LC_ADDRESS=bn_BD GNOME_SHELL_SESSION_MODE=ubuntu LC_NAME=bn_BD ................
Type echo $VARIABLE_NAME as like
echo $PATH
To set a global ENV
export NAME=Value
set NAME=Value
Example:
export ORACLE_HOME=/home/oracle/app/oracle/product/19.0.0/client_1
See more about setting environment variable
To set a local ENV
To set user wide ENVs
To set system wide ENVs
unset NAME
NAME=''
Thanks!