My .bashrc does
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
which includes runs my .bash_aliases
and gives me a ton of aliases that I've defined.
However if I try and use TMUX (invoked with tmux
) the only alias I now have is:
$ alias
return # will show....
$ alias rvm-restart='rvm_reload_flag=1 source '\''/home/durrantm/.rvm/scripts/rvm'\'''
How can I use tmux and still have all my aliases available.
I'm on Ubuntu 12.04
The end of my .bashrc file looks like this:
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Automatic cd'ing
shopt -s autocd
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM
export EDITOR=vim
git config --global --add color.ui true
Check Bash Aliases in LinuxInvoke your shell and simply type “alias” to see the list of defined alias. User-level aliases can be defined either in the . bashrc file or the . bash_aliases file.
Tmux uses a login shell by default. Hence, shells started by tmux skip ~/. bashrc . The default is an empty string, which instructs tmux to create a login shell using the value of the default-shell option.
Bash aliases allow you to set a memorable shortcut command for a longer command. Bash aliases are essentially shortcuts that can save you from having to remember long commands and eliminate a great deal of typing when you are working on the command line.
tmux invokes your shell as a login shell. Login shells don't process .bashrc
, but use .bash_profile
instead.
You can simply make .bash_profile
read your .bashrc
:
echo 'source ~/.bashrc' >> ~/.bash_profile
It would be better simply run bash
in tmux once the pane is "started". There is a difference btw login and interactive shells for a reason.
I would rather search for a way to run a command in every newly created pane.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With