Are you lazy enough to think of custom Linux command instead of using long commands repeatedly while you are on development? Then this post is for you. This post will help you to set custom shortcut for a command which you use multiple times a day.
alias command which will help us to create the custom shortcut commands.
alias command which will help us to create the custom shortcut commands.
alias db="mysql-uroot -proot"
This will create a temporary alias or short cut command "db". It will last till you end this session or closing the terminal. Now just try to enter "db" in terminal.
So If you want to create a permanent alias you have to go through some more steps.
- Create ~/.bash_aliases if not exists
touch ~/.bash_aliases
- Open ~/.bash_aliases in a editor and append alias db="mysql -uroot -proot"
or use command echo 'alias db="mysql -uroot -proot"' >> ~/.bash_aliases - Save it
- Use reload source ~/.bash_profile command to reload profile or reopen the terminal
Thats it. You have done it.