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

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.

主站蜘蛛池模板: 密云县| 锡林浩特市| 石狮市| 章丘市| 商河县| 贞丰县| 大竹县| 尉氏县| 固始县| 松原市| 定陶县| 香格里拉县| 海门市| 桓台县| 潢川县| 湖南省| 江川县| 巴彦淖尔市| 托克逊县| 蒙山县| 萨迦县| 库伦旗| 巴里| 葫芦岛市| 贺州市| 嵩明县| 石渠县| 廉江市| 景德镇市| 双城市| 察哈| 东港市| 武川县| 浮山县| 康乐县| 水富县| 商丘市| 公安县| 淮滨县| 宝山区| 河西区|