Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Setting of bash shell environment variable in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report