Variables store information. Environment variables are available for the whole environment.An environment variable consists of name=value pair.
Existing Environment Variables:
SHELL=/bin/bash= default shell program, in this case bashHOME=/home/nana= current user's home directoryUSER=nana = currently logged in userprintenv = List all environment variablesprintenv | less = List all environment variables with less programprintenv [environment variable] = Display value of given environment variable, e.g. printenv USERprintenv | grep USER = Filter environment variables, which have 'USER' in the nameecho $USER = Print value of USER environment variableCreate own Environment Variables:
export DB_USERNAME=dbuser = Set environment variable 'DB_USERNAME' with value 'dbuser'export DB_PASSWORD=secretpwdvalue = Set environment variable 'DB_PASSWORD' with value 'secretpwdvalue'export DB_NAME=mydb = Set environment variable 'DB_NAME' with value 'mydb'printenv | grep DB = Filter environment variables for 'DB' charactersexport DB_NAME=newdbname = Set environment variable 'DB_NAME' to new value 'newdbname'Delete Environment Variables:
unset DB_NAME = Delete variable with name 'DB_NAME'Persisting Environment Variables:
Persisting Environment Variables with shell specific configuration file: Environment variables set in terminal are only available in the current terminal session.