Automation of tasks in terminal is something natural in our favorite distribution. There are literally tons of scripts that run other scripts that are being executed by other scripts. Most of them though, have some weird names and you constantly use them with the same parameters over and over again…
One common way to automate the typing of a system command with its parameters is to create a “human readable” word and link it with that command.
This can be done by creating Aliases.
Alias: an alternative name or label that refers to a file, command, address, or other item, and can be used to locate or access it. — Wikipedia
Aliases can be simple words, that are easy to remember and descriptive of the actions that they perform. You can add your alias in a hidden file inside your Home directory called “.bashrc” .
The syntax to create aliases is :
To use them:
So lets get started… shall we ? Open your favorite text editor and open your .bashrc. You can start puting the following aliases at the end of the file. You can adjust any part of the aliases presented here, to your liking and make it perform the analogous action that is part of your distribution.
1 – Update my apps list
alias Update='sudo apt-get update'
2 – Install any available Upgrades
alias Upgrade='sudo apt-get dist-upgrade'
3 – Perform a cleanup of unnecessary packages
alias Clean='sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean'
4 – Uninstall an app with its configuration files
alias Remove='sudo apt-get purge'
5 – Install “that” app
alias Install='sudo apt-get install'
6 – Restart my system…. NOW !
alias Restart='sudo shutdown -r now'
7 – Shutdown my PC… NOW !
alias Poweroff='sudo shutdown -h now'
8 – Edit my awesome aliases
alias Editaliases='gedit ~/.bashrc'
Please do share with us any aliases that you have created so that other members of the community can use them. Last but not least, because we talked about laziness, you can just copy the following list and put it in your .bashrc file :)
alias Update='sudo apt-get update' alias Upgrade='sudo apt-get dist-upgrade' alias Clean='sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean' alias Remove='sudo apt-get purge' alias Install='sudo apt-get install' alias Restart='sudo shutdown -r now' alias Poweroff='sudo shutdown -h now' alias Editaliases='gedit ~/.bashrc'