官术网_书友最值得收藏!

Working with environment variables

Environmental variables are inherited by any subshells or child processes, for example, HOME, PATH. Every shell Terminal has a memory area called the environment. Shell keeps all details and settings in the environment. When we start a new Terminal or shell, this environment is created every time.

We can view the environment variables with the following command:

$ env

Or we can use this:

$ printenv

The output of the $ env command is as follows:

The list of environment variables will be quite extensive. I advise you to browse through the complete list. We can change the content of any of these environment variables.

Environmental variables are defined in a Terminal or shell. They will be available in any subshells or child shells created from the current shell Terminal. You will learn about these activities in the next few sections. You have already learned that every command in a shell creates a new subshell from the current shell.

The following is a brief summary of a few environmental variables:

Whenever any user logs in, the /etc/profile shell script is executed.

For every user, the .bash_profile Shell script is stored in the home folder. The complete path or location is /home/user_name/.profile.

Whenever a new Terminal is created, every new Terminal will execute script .bashrc, which is located in the home folder of every user.

主站蜘蛛池模板: 乌鲁木齐市| 吉安市| 武宣县| 汉阴县| 来宾市| 南川市| 敦煌市| 红河县| 汉寿县| 南乐县| 昌图县| 双桥区| 湟中县| 巴青县| 安陆市| 徐水县| 封开县| 穆棱市| 屏边| 宣汉县| 连云港市| 峨边| 璧山县| 开原市| 韶关市| 邯郸县| 定陶县| 赞皇县| 弋阳县| 吐鲁番市| 七台河市| 高阳县| 奉贤区| 怀化市| 河东区| 武陟县| 营山县| 永年县| 克山县| 奉新县| 普宁市|