Is it possible to reload bashrc with a terminal command?
Answering your question in the title of the thread, if you define an alias on the command line, then itāll be available throughout that entire session, as long as you donāt close the window.
Answering your second question, yes, you can reload ~/.bashrc
from the running sessionā¦
source ~/.bashrc
However, this is where I must point out that you must check whether you are indeed running bash
, because terminal window sessions now use zsh
by default in all three of the official Manjaro editions, and for zsh
you need ~/.zshrc
instead.
or using dot:
. ~/.bashrc
Yes, but considering that the dot is duplicitous in the eyes of newbies ā you know, as in ādot filesā ā I deliberately omitted that.
Indeed, the dot (.
) ā followed by a space ā is a built-in shell command that does the same thing as the (equally built-in) command source
.
Soā¦
. ~/.bashrc
⦠is the same thing asā¦
source ~/.bashrc
So when creating an alias at the command line, the alias can only be used during that session. Well \hen how can I make a permanent alias?
Canāt speak to ZSH, but you can put an alias in your .bashrc file:
alias <whatever_your_alias_name>='whatever_your_command_is'
Re-source your .bashrc, and viola.
As an aside, I have a .bash_aliases file. Keeps my .bashrc nice and neat.
To load zsh, we type zsh
Now we can type alias zsh='source ~/.zshrc
Also alias zshconfig='micro ~/.zshrc
Exit that terminal⦠open a new one and type bash
Then type zsh
- loads shell
Then type zshconfig
loads config.
By putting the alias inside your ~/.zshrc
.
Haha yes, I copied from the config but said just put in the terminal - after you put in the alias, you can test it with āzshconfigā and then edit the config.
Personally I prefer ācodeā and open it separately from the terminal.
but micro is good tooā¦
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.