LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   bashrc vs. bash_profile (https://www.linuxquestions.org/questions/linux-general-1/bashrc-vs-bash_profile-87412/)

mikeshn 08-30-2003 03:48 PM

bashrc vs. bash_profile
 
These two files looks pretty similar. What is the purpose of these files ?

Thanks

DrOzz 08-30-2003 04:01 PM

things like:
PATHS
custom PS1 strings
aliases
....etc,are stored in these files...

Skyline 08-30-2003 04:08 PM

One important distinction is that bash_profile is read when you loggin whereas bashrc is read each time you open a bash shell after youve logged in.

SaTaN 08-30-2003 04:11 PM

When you start a login shell, bash consults the following files in the specified order:
1. /etc/profile
2. ~/.bash.profile
3. ~/.bash_login
4. ~/.profile
When you start a nonlogin shell, bash consults only one startup file, ~/bash.rc.

mikeshn 09-24-2003 07:45 AM

Quote:

Originally posted by SaTaN
When you start a login shell, bash consults the following files in the specified order:
1. /etc/profile
2. ~/.bash.profile
3. ~/.bash_login
4. ~/.profile
When you start a nonlogin shell, bash consults only one startup file, ~/bash.rc.

What do you mean by "nonlogin shell"? When OS starts?

Skyline 09-24-2003 04:43 PM

Just think of a non-login shell as when you open a new instance of bash up after youve logged in - each time you do this the ~/.bashrc file is read - this file is good for putting Aliases in amongst other things.

bleedingpegasus 09-27-2003 07:27 PM

is there any command that can be use for restarting the .bash_profile, so don;t have to restart the whole pc?
i mean, like in windows, you can restart the 'explorer' only if you made changes in registry....

TIA.

SaTaN 09-27-2003 11:43 PM

On the command line:-
. .bash_profile

mikeshn 10-04-2003 08:20 PM

What .(dot) before .bash_profile does?

vamped 02-10-2008 01:46 PM

Quote:

Originally Posted by mikeshn (Post 517712)
What .(dot) before .bash_profile does?

It's been a long time, but for completeness:

If you run it like:
$ .bash_profile
it creates a new process to run the file. Any aliases created will be valid only for that process. When the file is finished running, that process ends, and the new aliases expire.
If you run it like:
$ . .bash_profile
it runs it in the current process. When the file is finished executing, the new aliases are still valid.

See $man . OR $man source


All times are GMT -5. The time now is 10:01 AM.