Bash alias: command not found

.bashrc is only read on startup. If you just modified your .bashrc then you need to get a new shell or get your current shell to see the changes applied:

  • source ~/.bashrc in your current shell (although this may cause some startup items to run twice, which could cause other issues)
  • exec bash to get a new shell
  • just open a new Terminal window

Error:

-bash: alias: cd /opt/logs: not found alias log= "cd /opt/logs"

Solution :

Ensure there is no space after the = symbol

log="cd**  /opt/logs"

Run bash and then try the command.

Alternatively, put it in ~/.bash_profile which should be loaded automatically.

Tags:

Macos

Bash

Alias