bashrc vs. bash_profile
These two files looks pretty similar. What is the purpose of these files ?
Thanks |
things like:
PATHS custom PS1 strings aliases ....etc,are stored in these files... |
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.
|
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. |
Quote:
|
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.
|
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. |
On the command line:-
. .bash_profile |
What .(dot) before .bash_profile does?
|
Quote:
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. |