Refresh aliases without reboot?
Solution 1
You can source /etc/bash.bashrc
to have your current shell re-read the file.
Solution 2
You can load the new aliases without reboot using source
command
source /etc/bash.bashrc
. (source or dot operator)
Read and execute commands from the filename argument in the current shell context.
Syntax . filename [arguments]
source filename [arguments]
source is a synonym for dot/period '.' in bash, but not in POSIX sh, so for maximum compatibility use the period.
When a script is run using source it runs within the existing shell, any variables created or modified by the script will remain available after the script completes. In contrast if the script is run just as filename, then a separate subshell (with a completely separate set of variables) would be spawned to run the script.
Related videos on Youtube
Arcticooling
Updated on September 18, 2022Comments
-
Arcticooling almost 2 years
After adding a new alias to
/etc/bash.bashrc
I couldn't use the alias unless I've rebooted via executingreboot
.I would prefer not to use
reboot
is because it's annoying to logout, wait 2-4 seconds, and login again to my VPS environment.Given I also don't want to work with a subshell or a separate shell in a new window, just for that, I ask:
Must I
reboot
? Is there no way to use the alias in the same shell without rebooting?