Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Locally I'm running Debian stable ~ bash -version 4.1.5 ...
Remotely my server is running Centos 5-8.el5 bash -version 3.2.25 ...

I have a .bash_alias file on both distros containing an alias 'll' for ls option --group-directories-first ... However, this option fails remotely ...

##############################################################                                                    
#                       BASH_ALIASES                                                                              
##############################################################                                                    
#-------------------------------------------------------------                                                    
# The 'ls' family                                                                                                 
#-------------------------------------------------------------                                                    
alias ll="ls -l --group-directories-first"                                                                        
alias ls='ls -hF --color'  # add colors for filetype recognition                                                  
alias la='ls -Al'          # show hidden files                                                                    
alias lx='ls -lXB'         # sort by extension                                                                    
alias lk='ls -lSr'         # sort by size, biggest last                                                           
alias lc='ls -ltcr'        # sort by and show change time, most recent last                                       
alias lu='ls -ltur'        # sort by and show access time, most recent last                                       
alias lt='ls -ltr'         # sort by date, most recent last                                                       
alias lm='ls -al |more'    # pipe through 'more'                                                                  
alias lr='ls -lR'          # recursive ls                                                                         
alias tree='tree -Csu'     # nice alternative to 'recursive ls'                                                   

# ------------------------------------------------------------                                                    
# Play nicely ...                                                                                                 
# ------------------------------------------------------------                                                    
alias rm='rm -i'                                                                                                  
alias rmdir='rmdir -p'                                                                                            
alias cp='cp -i'                                                                                                  
alias mv='mv -i'                                                                                                  
alias mkdir='mkdir -p'

Is this simply a difference in bash versions?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The .bash_alias file is non-standard and must be explicitly loaded in one of the automatically loaded files, e.g. .bashrc or .bash_profile. Use the following script snippet:

[[ -f ~/.bash_alias ]] && . .bash_alias

Make sure you are including .bash_alias in the correct one; local Linux terminals usually don't start login shells, so you'd use .bashrc, but via SSH on the remote system, bash will only load .bash_profile automatically. See the section INVOCATION in man bash.

share|improve this answer
    
Thanks for the reply ... I should have been more specific in stating that I have ~/.bashrc with the same on both boxes ... Here's .bashrc's contents both locally and remote ... –  Eddie B May 8 '12 at 21:14
    
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi –  Eddie B May 8 '12 at 21:24
    
Please read my entire answer. What use is a bashrc file when it won't get loaded in login shells? –  Daniel Beck May 8 '12 at 21:28
    
Ahh ... I'll check out Invocation ... appreciate the help ... –  Eddie B May 8 '12 at 21:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.