Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Answers to the questions on SO and askubuntu, along with poking through (and reading headers of) $HOME and /etc/, indicate a number of files that can be used to set environment variables, including:

  • ~/.profile
  • ~/.bashrc
  • ~/.bash_profile
  • ~/.gnomerc
  • ~/.Rprofile
  • /etc/bash_bashrc
  • /etc/profile
  • /etc/screenrc

I gather that files in /etc/ work for all users whereas files in $HOME are user-specific. I also gather that .profile is loaded at login whereas .bashrc loaded when /bin/bash is executed. I also understand that different programs have different settings files (e.g. .Rprofile for R). But I would appreciate some clarification:

  • Are *rc and *profile files fundamentally different?
  • What is the scope of such files (e.g. which files are are commonly used with Linux)
  • Is there a hierarchy (e.g. .bashrc overwrites variables set in .settings)
  • What is a good reference for this class of files? For the options in these files?


share|improve this question
See the INVOCATION section in man bash. See the FHS wiki article on Linux filesystems. That'll give you a good start and answer a couple of these questions. Files with a preceding dot (.) are typically user-specific - they reside in the user's $HOME directory. – user13742 Jun 13 '12 at 20:50
All of them? Really? – Ignacio Vazquez-Abrams Jun 13 '12 at 21:30
@IgnacioVazquez-Abrams I am not looking for the details, just a general description of how they relate and when one should be used over the other. – Abe Jun 14 '12 at 19:12

3 Answers 3

up vote 29 down vote accepted

The organization of configuration files is much less uniform than your questions seem to imply. There is no "class", there is no "hierarchy", and there is no global "configuration czar" nor committee that decrees a common syntax or other nice clean generalizations like the ones you are seeking. There is only a multitude of separate applications like R, bash, screen and the GNOME desktop environment, all of whom have their own ways of doing things, so you should look at the documentation for each individual program to answer any specific questions about a particular file. If it seems ad-hoc, that's because it is: most of Unix / Linux software out there was developed for different purposes by different people who all went about configuration slightly differently.

To answer your other questions pointwise:

  • *rc and *profile do not mean very much, so this question can't really be answered. "rc" is merely a commonly used abbreviation or suffix for configuration files. Its etymology goes back to ancient times (in computer years), and probably means run commands (from runcom). Just because applications use the same word does not mean they agree on conventions. "profile" is a much less common suffix.

  • Define "scope". Most applications do not share configuration files with other non-related applications. The one possible exception is /etc/profile and .profile, which may be used by multiple different shells (including at least sh and bash). There is something called an environment associated with every running process which can contain variables that may affect the behavior of said process. Generally, environment variables are set by the appropriate shell configuration files, or perhaps the configuration files of whatever graphical desktop environment you are using. There are also configuration files for "libraries", like .inputrc for readline and .gtkrc* for GTK, which will affect every application that uses the library.

  • No, there is no global hierarchy for configuration files. Again, refer to the documentation for the specific program in question, for example, the bash manual for bash. A general convention you can usually rely on is that user settings in $HOME override system-wide configuration in /etc. This is typically accomplished by reading the user file after the system one, so that later settings overwrite earlier ones. However, this is not a guarantee, and for definitive answers you should refer to the documentation for the specific program you are using.

  • There is no "class", at least none general enough to encompass all the files you've listed in your question, so the question of a reference for such a "class" is moot. Again, refer to the documentation of the specific program you are using.

share|improve this answer

I think this question is too broad on so many levels, e.g. you are asking questions about at least four different programs in one question. I'll only look at the difference between the configuration files in /etc and $HOME.

Unix is a multi-user operating system, this means many different persons can use a system, either by using ssh, telnet, or Xorg. To provide a standardized configuration for your users you can provide a system wide configuration in /etc/, this is typically also used by your Distribution to provide a global configuration for e.g. bash or screen.

On the other hand, some users want to customize the settings for their programs on their own like keybindings, colors or look. This is done via the configuration file in their $HOME. So in short /etc/ provides system wide configuration while the config files in $HOME allow users to change/override the system wide configuration.

share|improve this answer

I know it has been quite some time since you posted this question but I came across this question while I was searching for a similar question and found the answer. I believe these two articles should answer exactly what you are looking for:

The first deals specifically with .bash_profile and how to handle it. The second deals with the overall setup of the rest.

I hope this gives you a clear understanding what each file does and how to utilize them effectively. It helped me out far more than anything suggested here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.