- Learning Linux Shell Scripting
- Ganesh Naik
- 228字
- 2021-06-25 22:02:55
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.
- Internet接入·網絡安全
- 腦動力:Linux指令速查效率手冊
- Visualforce Development Cookbook(Second Edition)
- Practical Ansible 2
- 工業機器人技術及應用
- 機器學習及應用(在線實驗+在線自測)
- Julia 1.0 Programming
- MicroPython Projects
- 樂高創意機器人教程(中級 下冊 10~16歲) (青少年iCAN+創新創意實踐指導叢書)
- Visual Basic從初學到精通
- AWS Certified SysOps Administrator:Associate Guide
- 人工智能趣味入門:光環板程序設計
- Blender 3D Printing by Example
- Mastering Game Development with Unreal Engine 4(Second Edition)
- 單片機C語言應用100例