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.

By typing a manually specified command in terminal i want to do some.

How could add an alias to a command? Can i do that with the help of the terminal or should i edit some kind of file?

share|improve this question
1  
See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias –  Takkat Jun 22 '12 at 17:40

6 Answers 6

up vote 10 down vote accepted
alias new_name='old command'

For creating a permanent alias you've to edit the .bashrc file in youre home dir.

More info here

More .bashrc files here

share|improve this answer
1  
There is no manual entry for alias. It is a built-in command. You must look at the man page for the shell. –  dobey Jun 22 '12 at 15:40
    
Changed it. ty. –  OrangeTux Jun 23 '12 at 7:04

On the bash command line it is simply a case of typing:

alias my_command="Command to run"

For example to create a short command run a long listing you could do:

alias ll="ls -l"

The quotes are not required if you are not adding switches to the aliased command.

share|improve this answer

To make permanent changes in (in ubuntu at least, not sure for other distros) you can put your aliases separetely in ~/.bash_aliases

share|improve this answer

You can either use the alias built-in command in the shell you're using, or you can write a script which does what you want. Assuming you are using bash as the shell (which is the default), you can type man bash and skip down to the ALIASES section, for documentation on aliases in bash.

share|improve this answer

To learn about aliasing: visit http://www.mediacollege.com/linux/command/alias.html

To make the changes permanent (i.e. to be read everytime you start a shell) add the alias commands you typed in the terminal to the file ~/.bashrc file.

share|improve this answer

I write a GUI for adding/editing alias commands. You can also use it from commandline like this:

addalias -add "sinstall" "sudo apt-get install"

https://github.com/isamert/addalias

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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