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

The difference between bashrc and profile in Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "the difference between bashrc and profile in Linux". The explanation in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian and go deep into it slowly to study and learn "the difference between bashrc and profile in Linux" together!

Bashrc and profile in common operating systems

Let's first look at bashrc and profile in common Linux systems:

In CentOs:

/etc/profile/etc/bashrc~/.bashrc~/.bash_profile

In Ubuntu, Debian:

The requested URL/etc/profile/etc/bash.bashrc~/.bashrc~/.profileShell was not found on this server.

Before you can understand these files, you need to understand the login and interactive modes of Shell.

login shell and no-login shell

There are many kinds of shells in Linux system, such as bash, sh, zsh, etc. If you want to see what shell a user is using, you can use the finger [username] command to view it. We're only talking about shell bash here, because if it's sh or any other shell, it obviously won't run bashrc.

"login shell" stands for user login, such as using "su -" command, or using ssh to connect to a server, will use the user default shell to start login shell mode, the shell in this mode will automatically execute/etc/profile and ~/.profile files, but will not execute any bashrc files, so generally in/etc/profile or ~/.profile we will manually go to the source bashrc file.

In the case of no-login shell, we directly enter bash or bash -c "CMD" in the terminal to start the shell. In this mode, no profile file will be automatically run.

Thank you for reading, the above is the "bashrc and profile difference in Linux" content, after learning this article, I believe we have a deeper understanding of the difference between bashrc and profile in Linux, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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

Internet Technology

Wechat

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

12
Report