• notice
  • Congratulations on the launch of the Sought Tech site

.bash_profile .bash_rc what is the difference

In the past, the company's Linux seemed to write.bash_profile and it didn't work, so some aliases and PS1 were written in bashrc.
Now my computer is reversed and bashrc doesn't work.
What is the difference between writing bash_profile and these two files? Is there any way to configure it to load a certain file when the user logs in?


A:

Description of several bash configuration files:

/etc/profile: This file sets the environment information for each user of the system.When the user logs in for the first time, the file is executed.The shell settings are collected from the configuration file in the /etc/profile.d directory.
/etc/bashrc: Execute this file for every user who runs the bash shell.When the bash shell is opened, the file is read.
~/.bash_profile: Each user can use this file to input shell information dedicated to their own use.When the user logs in, the file is executed only once! By default, he sets some environment variables and executes the user's.bashrc file.
~/.bashrc: This file contains bash information specific to your bash shell, which is read when you log in and every time you open a new shell.
~/.bash_logout: This file is executed every time you exit the system (exit the bash shell).

In addition, the variables (global) set in /etc/profile can act on any user, while the variables (local) set in ~/.bashrc, etc.can only inherit the variables in /etc/profile, they are "father and child" "relation.


Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+