When working with bash and executing the same commands over and over, using aliases is essential to save time and effort.
Alias allows to create a alternative name for executing command(s) or script.
Here my few experience regarding what is the best way to use it.
- To indentify quickly the aliases I’ve created, the alias should start with the same prefix (my name).
- When I need to find quickly the requered alias, I put the prefix and press Tab twice to get the list of “my” aliases. Then i continue entering the needed name and press Tab again.
- To enable my aliases in the bash start I use ~/.bashrc script file. All my aliases I add there.
Example:
alias john-get-all-logs="cp -r /opt/com/myapp /home/john