My Bash aliases do not work

I'm not sure why, but my Bash aliases don't seem to work. Here is my .bashrc file

  # v 0.0.1 - 7/03/12 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting # expanding history to 10000 commands export HISTSIZE=10000 # don't store repeated commands more than once export HISCONTROL=ignoredups # where to look for Java export JAVA_HOME=/Library/Java/Home # tomcat server configuration export CATALINA_HOME=/usr/local/apache-tomcat-6.0.35 # default editor export EDITOR=vim if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi 

Here is my .bash_aliases file

 # v 0.0.1 - 7/03/12 # aliases for directory traversal alias ..='cd ../' alias ...='cd ../../' alias ....='cd ../../../' alias gs='git status ' alias ga='git add ' alias gb='git branch ' alias gc='git commit' alias gd='git diff' alias go='git checkout ' alias gk='gitk --all&' alias gx='gitx --all' alias got='git ' alias get='git ' 
+7
source share
7 answers

Add this to the end of your .bashrc :

 if [ -f $HOME/.bash_aliases ] then . $HOME/.bash_aliases fi 

ps

When you may also need to download this first [ref] [1]

 shopt -s expand_aliases 
+13
source

I recently had a similar problem. It seems that the solution closes ALL open shells (root and user; I did not notice that at that time I was launching a minimized root shell while editing my user .bashrc and .bash_aliases files). Then the .bash_aliases file was read.

+8
source

Bash is not looking for a file named .bash_aliases ; you must specify it explicitly.

Looking around a bit, ~/.bash_aliases from the original default .bashrc appears in the Ubuntu fields; I do not have access to confirmation. However, it is not a standard bash configuration file.

+2
source

I recently installed RVM and changed my terminal profile to "run the command as a login shell". This has disabled .bashrc from loading.

Fix: change → Profile settings → Name and command → Run the command as an input shell (uncheck the box)

Find this message for more information, fixed it for me.

https://askubuntu.com/questions/161249/bashrc-not-executed-when-opening-new-terminal

+2
source

Default

 if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi 

They are available in your .bashrc file on Ubuntu 18.19. Actually, the problem is finding files, so find both files by running the commands below. I ran into the same problems and this is how I solved it.

 source ~/.bashrc source ~/.bash_aliases 
+1
source

You need to include the file. Sample code for this from the default .bashrc :

 # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi 
0
source

Sometimes forgetting the bashrc source also creates this problem. Therefore, after adding aliases, do not forget to specify the source.

 source ~/.bashrc 
0
source

All Articles