Do you often find yourself typing a long command on the command line or searching on the internet when you need it? If yes, then bash aliases will avoid your headache. Bash aliases allow you to set a shortcut command.
I will explain how to create bash aliases so you can be more productive on the command line and finish your work quickly. I will also provide some useful aliases which might help you.
Creating Bash Aliases
Creating aliases are very straight forward. The syntax is as follows:
Open the file in text editor.
nano ~/.bashrc or sudo nano ~/.bashrc
As i am a PHP/Laravel developer i have created some aliases as fellows.
# Aliases # alias ALIAS_NAME="COMMAND_TO_RUN" alias pa="php artisan" alias pamm="php artisan make:model" alias pamc="php artisan make:controller" alias cdump="composer dumpautoload"
The aliases should be named in a way that is easy to remember. It is also recommended to add a comment for future reference. You can use
# keyword to add comments.
Now run one of the alias command in the terminal. Enjoy!