20

When I log in, I see the error:

bash: alias: alias: not found

If I source my .bashrc file, the message appears again.

What is causing this?

30

I had the same issue, so the solution is to follow simply rules.

alias alias_name='command '

no other symbols between equal sign.
I had whitespaces between the sign and the source ~/.bashrc always failed for me.
so be attenive

| improve this answer | |
  • This solved my problem. – Sandeep C Aug 18 '17 at 18:19
  • 1
    It solved mine as well ಠ_ಠ – MDMoore313 Aug 23 '18 at 20:34
6

It turns out that a line feed had been removed from ~/.bashrc, giving:

alias ll='ls -alF' alias la='ls -A'
alias l='ls -CF'

Breaking the first line into two commands fixes the error.

| improve this answer | |
4

In my case, removing spaces in alias = ls -alF solved the problem.

| improve this answer | |
  • If the command has spaces in it, surround it with single or double quotes. – Buttle Butkus Jun 26 '16 at 3:46
1

You can put quotes around the commands you are aliasing. You can even put them around the alias, too.

'llg'='ll | grep'

Newlines are also a problem. Widows-saved .bashrc file caused errors in Ubuntu virtual machine:

command not found

I ran dos2unix .bashrc to convert the line endings, and then everything worked.

| improve this answer | |
  • dos2unix did the trick for me – JAponte May 22 at 3:57
1

My problem is solved when I remove the space in

alias cdg = 'ls -al'

to

alias cdg='ls -al'
| improve this answer | |
0

I think you can do this:

alias 'll=ls -alF'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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