(014) Linux Environment

Source: Internet
Author: User

Fundamentals of the ten-year OPS series-Linux

Zeng Lin

Contact: [Email protected]

Website: www.jplatformx.com

Copyright: Please do not reprint the article without permission

First, Introduction

During the shell session invocation environment, the shell stores a large amount of information. Some programs look for variables stored in the environment to adjust their behavior. Knowing this, users can use the environment to customize the shell.

Second, what is stored in the environment

Although the shell stores two basic types of data in the environment, there is essentially no difference between the two types in bash. The two data types are environment variables and shell variables, respectively. The shell variable is a small amount of data that is stored by bash, and the environment variable is all other variables. In addition to variables, the shell stores some programming data, namely aliases and Shell functions.

To understand what is stored in your environment, you need to use the SET command or PRINTENV program integrated in bash. Instead, the set command displays both shell variables and environment variables, and printenv only displays environment variables.

The set command is as follows (which includes environment variables and shell variables):

Printenv command (includes only environment variables):

The environment variable contains quite a few variables, and the following table shows some common interesting environment variables.

Variable Description
SHELL Native Shell name
HOME The path name of the native home directory
Lang Defines the character set and collation for native languages
Old_pwd/pwd Previous working directory/current working directory
PATH A list of directories separated by colons that are found when the user enters the name of an executable program
PS1 The prompt string 1. Defines the contents of the native shell system prompt.
Term The name of the terminal type. UNIX-like systems support a wide variety of terminal protocols, which define the protocols used by the native terminal emulator
USER User name

Iii. How the environment is built

After the user logs on to the system, the Bash program starts and reads a series of configuration scripts called startup files that define the default environment shared by all users. Next, Bash reads more startup files that are stored in the home directory to define your personal environment. The exact order in which these steps are executed is determined by the type of shell session that is started.

(014) Linux Environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.