Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Ranch Hand
Posts: 1325
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: 69403
276
  • 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: 1325
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: 69403
276
  • 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: 21943
106
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.
 
Attractive, successful people love this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic