Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How to add an alias to a command in terminal?

I am looking for a way to make a shortcut command. For example, I want to execute the command g++-4.7 temp.cpp -o temp by running either G temp.cpp -o temp or g++ temp.cpp -o temp.

Is there a way to change the application's name for not having to type the complete name?

share|improve this question

marked as duplicate by nitstorm, Rinzwind, jokerdino, izx, atenz Aug 17 '12 at 10:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

Aliases can be created by supplying name / value pairs as arguments for the alias command. An example of the Bash shell syntax is:

$ alias name='unix command with options'

For example:

$ alias copy="cp"

In your case, alias G="g++-4.7" should work.

share|improve this answer
it seems that it's not working but the name is added when i press TAB, i mean It's what i'm getting : The program 'g++' can be found in the following packages: * g++ * pentium-builder (You will have to enable component called 'universe') Try: apt-get install <selected package> –  T0M XeOn LuCiFeR Aug 17 '12 at 9:39
but when i press tab instead of just g++-4.7 there's an extra g++. –  T0M XeOn LuCiFeR Aug 17 '12 at 9:39
@T0MXeOnLuCiFeR alias G="g++-4.7" –  Flint Aug 17 '12 at 9:45
tnx it worked...:) –  T0M XeOn LuCiFeR Aug 17 '12 at 9:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.