Home » Questions » Computers [ Ask a new question ]

What's the difference between /etc/bash.bashrc and ~/.bashrc? Which one should I use?

What's the difference between /etc/bash.bashrc and ~/.bashrc? Which one should I use?

When should I use each of the two .bashrc files to set my aliases, prompt, etc?

Asked by: Guest | Views: 321
Total answers/comments: 2
Guest [Entry]

"/etc/bash.bashrc applies to all users

~/.bashrc only applies to the user in which home folder it is."
Guest [Entry]

"For your personal preferences and personal scripts or bash functions you should use .bashrc ( aliases, Added functions to bash ... )

The moment that you want to share something with all users ( or most of users ) or for things of general use ( Path for shared executables , path for documentation ...) put it in /etc/bash.bashrc

I said most of users because even let's say you specify a script greetings.sh which prints ""Hello world!"" for all users, but user Pepe want to use instead the script greetings.sh which prints ""Hola el mundo!"". He can modify his path in his .bashrc to point to his script instead of yours. In other word the user can always customize his session in .bashrc to what ever he wants."