Setting of bash shell environment variable in Linux
This article focuses on the setting of bash shell environment variables in Linux. Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the setting of bash shell environment variables in Linux.
Alias
An alias is a shortcut to a command. It is useful to create shortcuts for long commands that need to be executed frequently but take a long time to enter. The syntax is:
Alias ppp='ping www.baidu.com'
They are not always used to shorten long commands. The important thing is that you use them for tasks you often perform. Possible examples:
Alias update='yum update'
So you can just use update to complete the command operation of yum update.
The problem with setting an alias in a terminal is that once the terminal session is closed, the alias is lost. To set them permanently, use a resource file.
Resource file
Resource files (that is, rc files) are configuration files that are loaded at the beginning of a session or process (when each user opens a new terminal window or starts a new program such as vim). For ZSH, the resource file is .zshrc, and for bash, it is .bashrc.
To make aliases permanent, you can put them in the resource file. You can use the text editor of your choice to edit the resource file. Vim is used here:
Vim $HOME/.zshrc
Or for bash:
Vim $HOME/.bashrc
In this way, after we create a new terminal, we can still use the commands we created to complete some longer command operations.
At this point, I believe you have a deeper understanding of the "setting of bash shell environment variables in Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!