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

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.

主站蜘蛛池模板: 浦东新区| 襄汾县| 曲松县| 涡阳县| 阳信县| 苗栗县| 泸水县| 台前县| 夏邑县| 临夏县| 林甸县| 城口县| 图们市| 长白| 青岛市| 唐山市| 泰顺县| 江安县| 班玛县| 井陉县| 清丰县| 滕州市| 开平市| 马公市| 岑巩县| 定州市| 宝应县| 重庆市| 平凉市| 安吉县| 左云县| 龙江县| 油尖旺区| 霸州市| 枞阳县| 贡山| 都匀市| 龙游县| 平罗县| 南木林县| 独山县|