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

What is the difference between Linux command aliases and resource files

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

Share

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

This article mainly introduces "what is the difference between Linux command aliases and resource files". In daily operation, I believe many people have doubts about the difference between Linux command aliases and resource files. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the difference between Linux command aliases and resource files?" Next, please follow the editor to study!

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, the study on "what is the difference between Linux command aliases and resource files" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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