How to reload .bash_profile from the command line? How to reload .bash_profile from the command line? bash bash

How to reload .bash_profile from the command line?


Simply type source ~/.bash_profile

Alternatively, if you like saving keystrokes you can type . ~/.bash_profile


. ~/.bash_profile

Just make sure you don't have any dependencies on the current state in there.


Simply type:

. ~/.bash_profile

However, if you want to source it to run automatically when terminal starts instead of running it every time you open terminal, you might add . ~/.bash_profile to ~/.bashrc file.

Note:

When you open a terminal, the terminal starts bash in (non-login) interactive mode, which means it will source ~/.bashrc.

~/.bash_profile is only sourced by bash when started in interactive login mode. That is typically only when you login at the console (Ctrl+Alt+F1..F6), or connecting via ssh.