Since i want to execute this command in different directories (without having to retype the entire path), i setup an alias in my home.bashrc file: An alias is a way of shortening a command (they are only used in interactive shells and not in scripts — this is one of the very few differences between a script and an interactive shell.) To create an alias, we need to create a file called bash_profile or bashrc This file needs to be in the root directory and should be hidden to avoid mishandling of its contents Inside of this file, we create an alias which is basically a map of commands and the sets of commands/functions to be executed as a shortcut.
Put your alias in a file call ~/.bash_aliases and then, on many distributions, it will get loaded automatically, no need to manually run the source command to load it. Aliases are useful to automate tasks in bash This article talks about bash alias and its intricacies with bash function. How do i permanently add aliases to my session If you want to add aliases for every user, place them either in /etc/bashrc or /etc/profile.d/useralias.sh file. You can, however, define aliases in your ~/.bashrc or in separate shell script that you source from (but not execute!).
Only interactive shells read ~/.bashrc on startup, and therefore only interactive shells load your alias or function definitions When the shell is started as a script interpreter, it does not load any external rc scripts and the alias is not defined. When you call the alias, it doesn't know what to do with the path, so you must include the bash at the beginning And resetting the terminal does help after making the change.
OPEN