
Lets first create a hidden file called .bash_aliases in your home directory with this command:
> ~/.bash_aliases; gedit ~/.bash_aliases
To add, for example, an alias for updating repositories, you can add this line to your file:
alias update='sudo apt-get update'
update -----> the name assigned to the 'sudo apt-get update' command. Save your file and exit. To test your alias, close the terminal and start it again, then test your alias by running this command:
update
'update' will serve as an abbreviation for the 'sudo apt-get update' command. Here are some other alias examples that you can add to the ~/.bash_aliases file:
alias upgrade='sudo apt-get upgrade'
alias inst='sudo apt-get install'
alias autorm='sudo apt-get autoremove'
NOTE: When adding new aliases, you have to restart your terminal so that they are taken into account.
That's it!
Post a Comment