Menu
Sudo apt-get install csh sudo mkdir /opt/gaussian cd /opt sudo chown. Echo 'export PATH=$PATH:/opt/gaussian/g09' /.bashrc source /.bashrc mkdir /scratch /jobs. C4.2xlarge 2h 11 min 1h 20 min 8 vcpu/16 Gb. The new code is strongly recommended except when comparison with results from Gaussian 03 is required. Stable=Opt defaults to the usual (L502) SCF procedure for the initial SCF but then uses SCF=QC for additional SCF calculations, if they are required. Changes between Gaussian 09 Revision A.01 and A.02: 1.
Active4 months ago
If I make changes to
shgnInc.bashrc
, how do I reload it without logging out and back in?1,12911 gold badge1414 silver badges2727 bronze badges
Jed DanielsJed Daniels
9,05544 gold badges2020 silver badges2323 bronze badges
17 Answers
You just have to enter the command:
or you can use the shorter version of the command:
Sojan V Jose2,51666 gold badges2828 silver badges4444 bronze badges
George HawkinsGeorge Hawkins24.9k55 gold badges1919 silver badges3333 bronze badges
or you could use;
does the same thing. (and easier to remember, at least for me)
exec command replaces the shell with given program, in our example, it replaces our shell with bash (with the updated configuration files)
WhoSayInWhoSayIn2,83622 gold badges1616 silver badges1818 bronze badges
To complement and contrast the two most popular answers,
. ~/.bashrc
and exec bash
:Both solutions effectively reload
~/.bashrc
, but there are differences:. ~/.bashrc
orsource ~/.bashrc
will preserve your current shell:- Except for the modifications that reloading
~/.bashrc
into the current shell (sourcing) makes, the current shell and its state are preserved, which includes environment variables, shell variables, shell options, shell functions, and command history.
- Except for the modifications that reloading
exec bash
, or, more robustly,exec '$BASH'
[1],will replace your current shell with a new instance, and therefore only preserve your current shell's environment variables (including ones you've defined ad-hoc).- In other words: Any ad-hoc changes to the current shell in terms of shell variables, shell functions, shell options, command history are lost.
Depending on your needs, one or the other approach may be preferred.
[1]
A note re
mklement0exec bash
could in theory execute a differentbash
executable than the one that started the current shell, if it happens to exist in a directory listed earlier in the $PATH
. Since special variable $BASH
always contains the full path of the executable that started the current shell, exec '$BASH'
is guaranteed to use the same executable.A note re
'...'
around $BASH
: double-quoting ensures that the variable value is used as-is, without interpretation by Bash; if the value has no embedded spaces or other shell metacharacters (which is not likely in this case), you don't strictly need double quotes, but using them is a good habit to form.mklement0
159k2626 gold badges278278 silver badges327327 bronze badges
Someone edited my answer to add incorrect English, but here was the original, which is inferior to the accepted answer.
Randy ProctorRandy Proctor5,61411 gold badge1919 silver badges2626 bronze badges
Depending on your environment, just typing
may also work.
JamesJames1,40911 gold badge1515 silver badges2121 bronze badges
With this, you won't even have to type 'source ~/.bashrc':
Include your bashrc file:
Every time you want to edit your bashrc, just run the alias 'rc'
Roy LinRoy Lin
Alternatives
exec
command replaces the shell with a given program... – WhoSayIn
6,18033 gold badges3030 silver badges3737 bronze badges
Depending upon your environment, you may want to add scripting to have .bashrc load automatically when you open an SSH session. I recently did a migration to a server running Ubuntu, and there, .profile, not .bashrc or .bash_profile is loaded by default. To run any scripts in .bashrc, I had to run
source ~/.bashrc
every time a session was opened, which doesn't help when running remote deploys.To have your .bashrc load automatically when opening a session, try adding this to .profile:
Reopen your session, and it should load any paths/scripts you have in .bashrc.
karoluskarolus
For me what works when I change the PATH is:
exec '$BASH' --login
Cecília ReginaCecília Regina
I used easyengine to set up my vultr cloud based server.
I found my bash file at
I found my bash file at
/etc/bash.bashrc
. So
source /etc/bash.bashrc
did the trick for me!update
When setting up a bare server (ubuntu 16.04), you can use the above info, when you have not yet set up a username, and are logging in via root.
It's best to create a user (with sudo privledges), and login as this username instead.
This will create a directory for your settings, including .profile and .bashrc files.
https://linuxize.com/post/how-to-create-a-sudo-user-on-ubuntu/
This will create a directory for your settings, including .profile and .bashrc files.
https://linuxize.com/post/how-to-create-a-sudo-user-on-ubuntu/
Now, you will edit and (and 'source') the
~/.bashrc
file. On my server, this was located at
(where
SherylHohmanSherylHohman/home/your_username/.bashrc
(where
your_username
is actually the new username you created above, and now login with)6,85599 gold badges4545 silver badges5858 bronze badges
exec bash is a great way to re-execute and launch a new shell to replace current. just to add to the answer, $SHELL returns the current shell which is bash. By using the following, it will reload the current shell, and not only to bash.
exec $SHELL -l;
Jimmy M.G. LimJimmy M.G. Lim
type:
source ~/.bashrc
or, in shorter form:
. ~/.bashrc
11.2k33 gold badges2424 silver badges4242 bronze badges
i use the following command on msysgit
shorter version of
Sojan V JoseSojan V Jose2,51666 gold badges2828 silver badges4444 bronze badges
Timo Tijhof8,67044 gold badges2424 silver badges4343 bronze badges
kirtikirti
I noticed that pure
exec bash
command will preserve the environment variables, so you need to use exec -c bash
to run bash in an empty environment. For example, you login a bash, and
export A=1
, if you exec bash
, the A 1
. If you
exec -cl bash
, A
is empty.I think this is the best way to do your job.
CatDogCatDog
Assuming an interactive shell, and you'd like to keep your current command history and also load /etc/profile (which loads environment data including /etc/bashrc and on Mac OS X loads paths defined in /etc/paths.d/ via path_helper), append your command history and do an exec of bash with the login ('-l') option:
beattidpbeattidp
i personally have
alias ..='source ~/.bashrc'
in my bashrc, so that i can just use '..' to reload it.
FloFlo
protected by Aniket ThakurAug 1 '15 at 4:58
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?