Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to "resource" by bash_profile without restarting terminal? [duplicate]

I often times have to make changes to my ~/.bash_profile, and I have to restart terminal for the changes to propagate. Is there any command I can run to re-source my ~/.bash_profile?

like image 551
user1530249 Avatar asked Jul 11 '16 00:07

user1530249


People also ask

Should I use bashrc or bash_profile?

bash_profile is read and executed when Bash is invoked as an interactive login shell, while . bashrc is executed for an interactive non-login shell. Use . bash_profile to run commands that should run only once, such as customizing the $PATH environment variable .

What is the use of bash_profile in Linux?

bash_profile is used for customizing the user configuration settings. This file is located in the home directory and is mostly hidden. The . bash_profile files are considered as configuration scripts.

How do I refresh my Mac terminal?

So, if you wanna restart the terminal, just enter rest (short for restart) in your terminal.


1 Answers

Yes, you can just run:

source ~/.bash_profile

Or:

. ~/.bash_profile

This will reload/re-source the .bash_profile in the current shell.

I put this command in my ~/.bash_profile for convenience:

alias reprofile='source ~/.bash_profile'

Then I just type reprofile or repro TAB.

like image 69
Will Avatar answered Nov 11 '22 06:11

Will