How to add an alias to a command in terminal?How to create shortcut for a command in terminal?Change command name in terminalHow to create shortcut commands in terminal?In terminal, how can I write 'sagi' instead of 'sudo apt-get install'Automatically pass command to TerminalRun a command using some textHow to create a permanent “alias”?Command line usage with dyslexiaHow can I disable usb-autosuspend for a specific device?Keyboard stops working Ubuntu 16.04How to run an alias in a shell script?Alias adder script in terminalSaw an interesting command but can't alias itHow can I install the alias command?add alias to rootAlias syntax for mpirunAlias not working as intended in .bashrc, while command doesHow can I use an alias in a function?How do I set an alias to a terminal line?

How to protect bash function from being overridden?

Would a horse be sufficient buffer to prevent injury when falling from a great height?

Can Fabled Passage generate two mana with Amulet of Vigor?

Why do many websites hide input when entering a OTP

Writing about real people - not giving offence

Could Boris Johnson face criminal charges for illegally proroguing Parliament?

Is morphing a creature effectively a cost?

Query to get counts of values per column

What is the Japanese equivalent of 'you're in my heart'?

Bothered by watching coworkers slacking off

Origin of movie opening crawl

Present participles of the verb esse

Did Joe Biden "stop a prosecution" into his son in Ukraine? And did he brag about stopping the prosecution?

Table formatting with multicolumn

Quote to show students don't have to fear making mistakes

Airport Security - advanced check, 4th amendment breach

Check if number is in list of numbers

Mac no longer boots

Disable all sound permanently

Is it appropriate to "shop" through high-impact journals before sending the paper to more specialized journals?

What are one's options when facing religious discrimination at the airport?

As a girl, how can I voice male characters effectively?

Has Boris Johnson ever referred to any of his opponents as "traitors"?

Canteen Cutlery Issue



How to add an alias to a command in terminal?


How to create shortcut for a command in terminal?Change command name in terminalHow to create shortcut commands in terminal?In terminal, how can I write 'sagi' instead of 'sudo apt-get install'Automatically pass command to TerminalRun a command using some textHow to create a permanent “alias”?Command line usage with dyslexiaHow can I disable usb-autosuspend for a specific device?Keyboard stops working Ubuntu 16.04How to run an alias in a shell script?Alias adder script in terminalSaw an interesting command but can't alias itHow can I install the alias command?add alias to rootAlias syntax for mpirunAlias not working as intended in .bashrc, while command doesHow can I use an alias in a function?How do I set an alias to a terminal line?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









33















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?










share|improve this question





















  • 2





    See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias

    – Takkat
    Jun 22 '12 at 17:40

















33















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?










share|improve this question





















  • 2





    See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias

    – Takkat
    Jun 22 '12 at 17:40













33












33








33


8






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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 25 '17 at 4:34









Zanna

53.3k15 gold badges150 silver badges251 bronze badges




53.3k15 gold badges150 silver badges251 bronze badges










asked Jun 22 '12 at 14:49









Rootical V.Rootical V.

4552 gold badges7 silver badges12 bronze badges




4552 gold badges7 silver badges12 bronze badges










  • 2





    See also here: askubuntu.com/questions/1414/how-to-create-a-permanent-alias

    – Takkat
    Jun 22 '12 at 17:40












  • 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










7 Answers
7






active

oldest

votes


















40
















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






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


















12
















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


































    8
















    To make permanent changes you can put your aliases separetely in ~/.bash_aliases






    share|improve this answer






















    • 1





      Don't forget to run source ~/.bash_aliases for the change to take effect.

      – Stoyan Dimov
      Nov 30 '18 at 10:40


















    2
















    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
































      1
















      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
































        1
















        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
































          0
















          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






          share|improve this answer


























            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/4.0/"u003ecc by-sa 4.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
            );



            );














            draft saved

            draft discarded
















            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









            40
















            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






            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















            40
















            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






            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













            40














            40










            40









            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






            share|improve this answer















            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







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 25 '17 at 4:35









            Zanna

            53.3k15 gold badges150 silver badges251 bronze badges




            53.3k15 gold badges150 silver badges251 bronze badges










            answered Jun 22 '12 at 14:59









            OrangeTuxOrangeTux

            3,7388 gold badges25 silver badges53 bronze badges




            3,7388 gold badges25 silver badges53 bronze badges










            • 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





              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













            12
















            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































              12
















              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





























                12














                12










                12









                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















                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














                share|improve this answer



                share|improve this answer








                edited Jun 15 '13 at 18:44









                Radu Rădeanu

                127k36 gold badges269 silver badges335 bronze badges




                127k36 gold badges269 silver badges335 bronze badges










                answered Jun 22 '12 at 15:00









                AdamAdam

                2761 silver badge6 bronze badges




                2761 silver badge6 bronze badges
























                    8
















                    To make permanent changes you can put your aliases separetely in ~/.bash_aliases






                    share|improve this answer






















                    • 1





                      Don't forget to run source ~/.bash_aliases for the change to take effect.

                      – Stoyan Dimov
                      Nov 30 '18 at 10:40















                    8
















                    To make permanent changes you can put your aliases separetely in ~/.bash_aliases






                    share|improve this answer






















                    • 1





                      Don't forget to run source ~/.bash_aliases for the change to take effect.

                      – Stoyan Dimov
                      Nov 30 '18 at 10:40













                    8














                    8










                    8









                    To make permanent changes you can put your aliases separetely in ~/.bash_aliases






                    share|improve this answer















                    To make permanent changes you can put your aliases separetely in ~/.bash_aliases







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited May 25 '17 at 4:36









                    Zanna

                    53.3k15 gold badges150 silver badges251 bronze badges




                    53.3k15 gold badges150 silver badges251 bronze badges










                    answered Mar 25 '13 at 8:35









                    Yann SagonYann Sagon

                    2211 gold badge3 silver badges5 bronze badges




                    2211 gold badge3 silver badges5 bronze badges










                    • 1





                      Don't forget to run source ~/.bash_aliases for the change to take effect.

                      – Stoyan Dimov
                      Nov 30 '18 at 10:40












                    • 1





                      Don't forget to run source ~/.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











                    2
















                    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





























                      2
















                      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



























                        2














                        2










                        2









                        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













                        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












                        share|improve this answer



                        share|improve this answer










                        answered Jun 22 '12 at 14:58









                        dobeydobey

                        34.3k3 gold badges41 silver badges88 bronze badges




                        34.3k3 gold badges41 silver badges88 bronze badges
























                            1
















                            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





























                              1
















                              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



























                                1














                                1










                                1









                                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













                                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












                                share|improve this answer



                                share|improve this answer










                                answered Jun 22 '12 at 14:58









                                drake01drake01

                                2,8351 gold badge14 silver badges13 bronze badges




                                2,8351 gold badge14 silver badges13 bronze badges
























                                    1
















                                    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





























                                      1
















                                      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



























                                        1














                                        1










                                        1









                                        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













                                        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












                                        share|improve this answer



                                        share|improve this answer










                                        answered Aug 14 '14 at 12:51









                                        isamertisamert

                                        1465 bronze badges




                                        1465 bronze badges
























                                            0
















                                            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






                                            share|improve this answer





























                                              0
















                                              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






                                              share|improve this answer



























                                                0














                                                0










                                                0









                                                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






                                                share|improve this answer













                                                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







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jan 24 at 15:02









                                                Erik PillonErik Pillon

                                                1012 bronze badges




                                                1012 bronze badges































                                                    draft saved

                                                    draft discarded















































                                                    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.




                                                    draft saved


                                                    draft discarded














                                                    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





















































                                                    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







                                                    Popular posts from this blog

                                                    Tamil (spriik) Luke uk diar | Nawigatjuun

                                                    Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                                                    Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?