Toolbar
  • Layout
    Linear Layout
    Grid Layout
Linux Training - Utilizing Shell Environment Variables

Linux Training - Utilizing Shell Environment Variables

The Linux Shell Environment and the Atmosphere Variables

A Linux terminal or a terminal emulation window provides you entry to the "bash shell atmosphere" so you can run Linux commands. And there are several "atmosphere variables" that you can 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 surroundings in your current user.

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

Linux Instructions rhcsa training Malaysia Suggestions: The Linux System Administration ideas and instructions covered here apply to ALL different Linux distributions, together with: Debian, Ubuntu, Slackware, SUSE, openSUSE, Red Hat, Fedora, Edubuntu - and Kubuntu.

Bash Shell Setting Variable Examples

Listed here are some examples of frequent Linux atmosphere variables.

SHELL

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

USER

Contains the name of the currently logged in user.

HOME

Holds the full directory path to the current person's home directory.

For example, when you're working as a non-root consumer, the trail will likely be /dwelling/personname, where personname would be the name you logged in with. In case you logged in as bhatch, then the path will likely be /dwelling/bhatch.

As one other instance, if you're working as the basis consumer, then the trail will merely be /root.

PS1

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

For instance, you should use this variable to specify how the immediate seems to be, corresponding to whether to show the current directory and the character that appears on the far right of the prompt.

LOGNAME

Shows the currently logged in user name.

Viewing Environmet Variables with the Linux echo Command

You may run the echo command and prefix a variable with a $ (dollar sign) to see the contents of a variable.

Run the echo command below to see your current consumer name.

$ echo $USER

Press the up arrow key to repeat the last command and press backarea to remove the variable and exchange it with the variable that shows the trail to the home directory for the current user.

Now do the same as above with the opposite surroundings variables described above.

Goes Photography

Santa Monica Photography Studio

Not Enough. Want to stay informed? Follow me now...