Error
  • La plantilla para esta vista no está disponible. Por favor, póngase en contacto con el administrador del sitio.
Suscribirse a este canal RSS
Linux Training - Utilizing Shell Setting Variables

Linux Training - Utilizing Shell Setting Variables

The Linux Shell Setting and the Setting Variables

A Linux terminal or a terminal emulation window offers you entry to the "bash shell surroundings" so you can run Linux commands. And there are a number of "environment variables" that you can work with when using Linux scripts, programs, and instructions, and to view system information.

You run the env (setting) command with none options to see the environment to your present user.

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

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

Bash Shell Environment Variable Examples

Listed here are some examples of frequent Linux surroundings variables.

SHELL

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

USER

Accommodates the name of the presently logged in user.

HOME

Holds the complete directory path to the present person's residence directory.

For instance, in case you're working as a non-root person, the trail will likely be /house/personname, where consumername would be the name you logged in with. In the event you logged in as bhatch, then the trail will be /dwelling/bhatch.

As one other instance, in the event you're working as the foundation person, then the path will simply be /root.

PS1

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

For example, you need to use this variable to specify how the immediate appears, resembling whether or not to show the current directory and the character that appears on the far right of the prompt.

LOGNAME

Shows the at present 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 $ (greenback signal) to see the contents of a variable.

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

$ echo $USER

Press the up arrow key to repeat the final command and press backspace to take away the variable and substitute it with the variable that shows the path to the house directory for the current user.

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