0

So I have added an alias for jumping to another directory like this

in my ./bashrc file , Looks like this

alias crmx="cd /var/www/crm/website-crm/"

Then i saved the file

but when I try to run

crmx 

it says

command not found

Also I tried to do alias to see all the command but my command is not listed

Any idea ?

Vikram Anand Bhushan
  • 4,368
  • 12
  • 46
  • 118
  • 2
    source the file after you save it. `source bashrc`.The bashrc file's changing don't affect current bash process – amow Oct 11 '16 at 05:39
  • Also in centos it should be .bashrc .Don't know if you save the file with correct name.And also Be aware of the difference between `bashrc` and `bash_profile`. – amow Oct 11 '16 at 05:41

2 Answers2

1

Let's suppose you are on bash.

Once you saved that file, you have to have bash read it with a command like this:

. ~/myaliasfile

or like this

source ~/myaliasfile

if the file resides in your home directory. Specify the path (relative to your home or absolute) otherwise.

Then you'd go to your .bashrc file and add the very same line to the end of it. By doing so the alias(es) will be read and made available to every single bash invocation and login.

Done!

More details here and here.

EnzoR
  • 2,523
  • 2
  • 16
  • 19
1

The file is ~/.bashrc (starting with a dot).

And you have to source it (reload) by doing source ~/.bashrc or just by closing and reopening your terminal.

You can also type ps to check if your shell is bash (for example if it's zsh you have put your alias in the ~/.zshrc file)