This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Difference between etc/bashrc and home/username/.bashrc?

 
Ranch Hand
Posts: 1322
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found that there are two kind of bashrc files in the linux folder stucture. one is located in etc/bashrc. Other one is located in Home/username/.bashrc.

1) What is the difference purpose of these two files ?
2) are both using for setting envirnment variables?
 
Marshal
Posts: 65085
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you open both those files with a text editor and have a look at them.
The file in /etc will run whenever any user opens a terminal with bash, but that in your home directory will only run when you open a terminal. Other users will have other .bashrc files in their home folders. I don't know which runs first.
 
shawn peter
Ranch Hand
Posts: 1322
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added echo command in both files. Then i open new terminal it shows both echo commands. first shows the etc echo command and then shows the other echo commands. that means bashrc in the etc folder runs 1st.
 
Campbell Ritchie
Marshal
Posts: 65085
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

sam liya wrote:. . . bashrc in the etc folder runs 1st.

That is what I would have expected, but I wasn't sure.
 
Sheriff
Posts: 21775
103
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Summarizing: /etc/bashrc contains system defaults for all users, and ~/.bashrc contains user-specific additions. The latter is optional, if it does not exist then only the defaults are used.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!