Do you have a set of commands that you find you repeat over and over in your daily use? Things like connecting to servers over ssh, rsyncing data launching apps with a slew of argumets. You know what I mean. Well you can make things easier on yourself by creating alias commands for your account. Below are a few examples:
ssh [email protected] -p 22222 could be setup in an alias defined as ‘connectwork’
rsync -avz –progress daily/backup/file/ [email protected]:/remote/directory could be defined as ‘dailybackup’
By setting these longer commands as local aliases all you have to do is type the alias name, which is then connected to the command and you’ve saved yourself a load of typing. Yes, this appeals to us because we work hard but don’t want to work any harder than needed!
To create an alias you’ll want to edit your local .bashrc file. This file defines a number of shell options for your account but also can store any aliases you want to define. The default file has a few example aliases set, and all you have to do to create your own are append them to the list. A sample entry would look like this:
alias aoeu=’setxkbmap us’ (this will switch keyboard layouts to qwerty)
alias asdf=’setxkxmap dvorak’ (this will switch keyboard layouts to dvorak)
alias updateme=’sudo aptitude update && sudo aptitude upgrade && sudo aptitude dist-upgrade && sudo aptitude autoclean’ (check for, download, install and cleanup after updates)
As you can tell from these few examples you’re able to create an alias for your user on the shell for whatever you like. It can save you typing, help automate repetitive commands, and make your life easier. Give it a try.