How to add an alias to a command in terminal?
By typing a manually specified command in terminal I want to execute some other command.
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?
command-line bashrc alias
add a comment |
By typing a manually specified command in terminal I want to execute some other command.
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?
command-line bashrc alias
2
See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias
– Takkat
Jun 22 '12 at 17:40
add a comment |
By typing a manually specified command in terminal I want to execute some other command.
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?
command-line bashrc alias
By typing a manually specified command in terminal I want to execute some other command.
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?
command-line bashrc alias
command-line bashrc alias
edited May 25 '17 at 4:34
Zanna
50.9k13136241
50.9k13136241
asked Jun 22 '12 at 14:49
Rootical V.Rootical V.
4352712
4352712
2
See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias
– Takkat
Jun 22 '12 at 17:40
add a comment |
2
See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias
– Takkat
Jun 22 '12 at 17:40
2
2
See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias
– Takkat
Jun 22 '12 at 17:40
See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias
– Takkat
Jun 22 '12 at 17:40
add a comment |
7 Answers
7
active
oldest
votes
alias new_name='old command'
To create a permanent alias you have to edit the .bashrc
file in your home directory.
More info here
More .bashrc files here
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
add a comment |
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.
add a comment |
To make permanent changes you can put your aliases separetely in ~/.bash_aliases
1
Don't forget to runsource ~/.bash_aliases
for the change to take effect.
– Stoyan Dimov
Nov 30 '18 at 10:40
add a comment |
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.
add a comment |
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.
add a comment |
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
add a comment |
You can directly create a file in your home for collecting all the aliases .bash_profile
by writing nano ~.bash_profile
and simply write on the file the commands/shortcuts you want to create, for example:
alias edbp='nano ~/.bash_profile'
and then validate it sourcing the file, so running
source ~.bash_profile
Remember that every time you modify your document you have to run again source ~.bash_profile
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f154640%2fhow-to-add-an-alias-to-a-command-in-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
alias new_name='old command'
To create a permanent alias you have to edit the .bashrc
file in your home directory.
More info here
More .bashrc files here
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
add a comment |
alias new_name='old command'
To create a permanent alias you have to edit the .bashrc
file in your home directory.
More info here
More .bashrc files here
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
add a comment |
alias new_name='old command'
To create a permanent alias you have to edit the .bashrc
file in your home directory.
More info here
More .bashrc files here
alias new_name='old command'
To create a permanent alias you have to edit the .bashrc
file in your home directory.
More info here
More .bashrc files here
edited May 25 '17 at 4:35
Zanna
50.9k13136241
50.9k13136241
answered Jun 22 '12 at 14:59
OrangeTuxOrangeTux
3,59782452
3,59782452
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
add a comment |
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
1
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
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
Changed it. ty.
– OrangeTux
Jun 23 '12 at 7:04
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited Jun 15 '13 at 18:44
Radu Rădeanu
118k35250325
118k35250325
answered Jun 22 '12 at 15:00
AdamAdam
27616
27616
add a comment |
add a comment |
To make permanent changes you can put your aliases separetely in ~/.bash_aliases
1
Don't forget to runsource ~/.bash_aliases
for the change to take effect.
– Stoyan Dimov
Nov 30 '18 at 10:40
add a comment |
To make permanent changes you can put your aliases separetely in ~/.bash_aliases
1
Don't forget to runsource ~/.bash_aliases
for the change to take effect.
– Stoyan Dimov
Nov 30 '18 at 10:40
add a comment |
To make permanent changes you can put your aliases separetely in ~/.bash_aliases
To make permanent changes you can put your aliases separetely in ~/.bash_aliases
edited May 25 '17 at 4:36
Zanna
50.9k13136241
50.9k13136241
answered Mar 25 '13 at 8:35
Yann SagonYann Sagon
211135
211135
1
Don't forget to runsource ~/.bash_aliases
for the change to take effect.
– Stoyan Dimov
Nov 30 '18 at 10:40
add a comment |
1
Don't forget to runsource ~/.bash_aliases
for the change to take effect.
– Stoyan Dimov
Nov 30 '18 at 10:40
1
1
Don't forget to run
source ~/.bash_aliases
for the change to take effect.– Stoyan Dimov
Nov 30 '18 at 10:40
Don't forget to run
source ~/.bash_aliases
for the change to take effect.– Stoyan Dimov
Nov 30 '18 at 10:40
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Jun 22 '12 at 14:58
dobeydobey
32.8k33686
32.8k33686
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Jun 22 '12 at 14:58
drake01drake01
2,68511213
2,68511213
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Aug 14 '14 at 12:51
isamertisamert
465
465
add a comment |
add a comment |
You can directly create a file in your home for collecting all the aliases .bash_profile
by writing nano ~.bash_profile
and simply write on the file the commands/shortcuts you want to create, for example:
alias edbp='nano ~/.bash_profile'
and then validate it sourcing the file, so running
source ~.bash_profile
Remember that every time you modify your document you have to run again source ~.bash_profile
add a comment |
You can directly create a file in your home for collecting all the aliases .bash_profile
by writing nano ~.bash_profile
and simply write on the file the commands/shortcuts you want to create, for example:
alias edbp='nano ~/.bash_profile'
and then validate it sourcing the file, so running
source ~.bash_profile
Remember that every time you modify your document you have to run again source ~.bash_profile
add a comment |
You can directly create a file in your home for collecting all the aliases .bash_profile
by writing nano ~.bash_profile
and simply write on the file the commands/shortcuts you want to create, for example:
alias edbp='nano ~/.bash_profile'
and then validate it sourcing the file, so running
source ~.bash_profile
Remember that every time you modify your document you have to run again source ~.bash_profile
You can directly create a file in your home for collecting all the aliases .bash_profile
by writing nano ~.bash_profile
and simply write on the file the commands/shortcuts you want to create, for example:
alias edbp='nano ~/.bash_profile'
and then validate it sourcing the file, so running
source ~.bash_profile
Remember that every time you modify your document you have to run again source ~.bash_profile
answered Jan 24 at 15:02
Erik PillonErik Pillon
1012
1012
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f154640%2fhow-to-add-an-alias-to-a-command-in-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias
– Takkat
Jun 22 '12 at 17:40