(ve):Create command-line alias on Ubuntu
- This page was last modified on December 16, 2010, at 13:57.
From (mt) Community Wiki
Contents |
Requirements
This article assumes the following:
- You have an Ubuntu LAMP stack on your (ve) Server.
- You are familiar with connecting to your (ve) via SSH.
Overview
An alias can shorten an otherwise lengthy command or string of commands. The syntax is:
alias foo='bar'
For example, updating your packages is done with 'apt-get update && apt-get upgrade'. This is lengthy to type every time you want to update your installed packages. I have created an alias for this command string for getting updates on the repository servers and then the installed packages.
alias up='apt-get update && apt-get upgrade'
This will let you type 'up' into the terminal and produce the same results as if I entered the full string.
When you have created the alias, you will need to add the alias command you entered so as to make it permanent after reboots.
This can be done by adding a small tail to your alias command:
echo "alias up='apt-get update && apt-get upgrade'" >> ~/.bashrc
Convenient aliases
- addapp='apt-get install --yes'