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.

I have a separate file .bash_aliases , in the same directory as .bashrc, that I wish to be ran on start, I've added the lines:

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

to my .bashrc but none of the commands in the .bash_aliases file are working.

My .bash_alises file

ll='ls -l'
sublime='/home/colin/bin/SublimeText2/sublime_text'
share|improve this question
    
Try using absolute addresses, not relative ones. –  MariusMatutiae Nov 11 '13 at 12:39
    
Made no difference. –  Colin747 Nov 11 '13 at 12:58
    
Did you check if the .bashrc itself gets executed? You can insert for example this testing code: { date --rfc-3339=seconds ; ps ; } >/tmp/bashrc$$. –  pabouk Nov 11 '13 at 13:10
    
If I uncomment an ll command out and run source ~/.bashrc that command then works so I assume it is getting executed. –  Colin747 Nov 11 '13 at 13:17
    
What commands are inside your ~/.bash_aliases file? –  grawity Nov 11 '13 at 14:12
show 1 more comment

2 Answers 2

up vote 3 down vote accepted

your .bash_aliases file should look like.

alias ll='ls -l'
alias sublime='/home/colin/bin/SublimeText2/sublime_text'

(note the extra alias at the start of the command).

share|improve this answer
    
.....don't know how I missed that....I was even creating temporary alias's using those exact commands.....thanks for the answer! :) –  Colin747 Nov 11 '13 at 15:41
    
no problem..... –  Krishna Nov 11 '13 at 15:46
add comment

try

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

with absolute paths of course

share|improve this answer
    
I've tried if [ -f /home/colin/.bash_aliases ]; then source /home/colin/.bash_aliases fi but the command in the file is still not found. –  Colin747 Nov 11 '13 at 14:13
    
as grawity asked, can you paste at least the beginnig of your bash_aliases? –  Bruno9779 Nov 11 '13 at 14:50
    
See edit for whole file –  Colin747 Nov 11 '13 at 14:52
add comment

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.