Linux Training - Using Shell Atmosphere Variables

Linux Training - Using Shell Atmosphere Variables

The Linux Shell Setting and the Atmosphere Variables

A Linux terminal or a terminal emulation window provides you entry to the "bash shell atmosphere" so you'll be able to run Linux commands. And there are a number of "surroundings variables" you could work with when utilizing Linux scripts, programs, and commands, and to view system information.

You run the env (surroundings) command without any options to see the atmosphere to your present user.

Run this Linux command now to see your current environment variable settings.

Linux Instructions Training Ideas: The Linux System Administration ideas and commands covered right here apply to ALL other Linux distributions, together with: Debian, Ubuntu, Slackware, SUSE, openSUSE, red hat training and certification Hat, Fedora, Edubuntu - and Kubuntu.

Bash Shell Environment Variable Examples

Listed below are some examples of frequent Linux surroundings variables.


This variable holds the name of the present Linux shell, which is mostly the "bash" shell.


Accommodates the name of the presently logged in user.


Holds the total directory path to the present consumer's house directory.

For instance, in case you're working as a non-root consumer, the trail can be /dwelling/username, where personname will be the name you logged in with. For those who logged in as bhatch, then the path will likely be /residence/bhatch.

As another example, if you're working as the basis consumer, then the trail will merely be /root.


Used to include the settings for displaying the current Linux command line prompt.

For instance, you can use this variable to specify how the immediate looks, equivalent to whether to show the present directory and the character that seems on the far right of the prompt.


Shows the presently logged in consumer name.

Viewing Environmet Variables with the Linux echo Command

You possibly can run the echo command and prefix a variable with a $ (dollar signal) to see the contents of a variable.

Run the echo command under to see your present person name.

$ echo $USER

Press the up arrow key to repeat the last command and press backhouse to take away the variable and replace it with the variable that shows the path to the house directory for the present user.

Now do the identical as above with the opposite environment variables described above.