Use “alias” in Linux

In file “~/.bash_profile“, we can use alias to define keyword shorter to run app faster 🙂

Example: In server has been installed redis. To run redis-server we must run command “/opt/redis/latest/bin/redis-server”. We can use alias in “~/.bash_profile“:

alias redis-server="/opt/redis/latest/bin/redis-server"

And with redis-cli we must run command: “/opt/redis/latest/bin/redis-cli”. We can use alias:

alias redis-cli="/opt/redis/latest/bin/redis-cli"

And now, we can type redis-server or redis-cli in terminal instead of long command: “/opt/redis/latest/bin/redis-server” and “/opt/redis/latest/bin/redis-cli”.

 

When we added alias to “~/.bash_profile“, we can reload “~/.bash_profile” by the way:

. ~/.bash_profile