How to retrieve lost aliases?












17















I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?










share|improve this question




















  • 9





    What if you just type alias? It will show what you have defined.

    – fedorqui
    Jul 23 '14 at 15:04






  • 3





    Your next question is now required to be about setting up a backup system. :-/

    – derobert
    Jul 23 '14 at 16:06






  • 2





    Your next task, as soon as you've recreated your .bash_aliases, is to set up version control for your dot files.

    – Gilles
    Jul 23 '14 at 23:02











  • @Gilles even better: unix.blogoverflow.com/2014/04/…

    – strugee
    Jul 24 '14 at 5:26
















17















I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?










share|improve this question




















  • 9





    What if you just type alias? It will show what you have defined.

    – fedorqui
    Jul 23 '14 at 15:04






  • 3





    Your next question is now required to be about setting up a backup system. :-/

    – derobert
    Jul 23 '14 at 16:06






  • 2





    Your next task, as soon as you've recreated your .bash_aliases, is to set up version control for your dot files.

    – Gilles
    Jul 23 '14 at 23:02











  • @Gilles even better: unix.blogoverflow.com/2014/04/…

    – strugee
    Jul 24 '14 at 5:26














17












17








17


0






I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?










share|improve this question
















I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?







bash command-line alias bashrc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago









Rui F Ribeiro

39.6k1479132




39.6k1479132










asked Jul 23 '14 at 12:58









MrUserMrUser

32229




32229








  • 9





    What if you just type alias? It will show what you have defined.

    – fedorqui
    Jul 23 '14 at 15:04






  • 3





    Your next question is now required to be about setting up a backup system. :-/

    – derobert
    Jul 23 '14 at 16:06






  • 2





    Your next task, as soon as you've recreated your .bash_aliases, is to set up version control for your dot files.

    – Gilles
    Jul 23 '14 at 23:02











  • @Gilles even better: unix.blogoverflow.com/2014/04/…

    – strugee
    Jul 24 '14 at 5:26














  • 9





    What if you just type alias? It will show what you have defined.

    – fedorqui
    Jul 23 '14 at 15:04






  • 3





    Your next question is now required to be about setting up a backup system. :-/

    – derobert
    Jul 23 '14 at 16:06






  • 2





    Your next task, as soon as you've recreated your .bash_aliases, is to set up version control for your dot files.

    – Gilles
    Jul 23 '14 at 23:02











  • @Gilles even better: unix.blogoverflow.com/2014/04/…

    – strugee
    Jul 24 '14 at 5:26








9




9





What if you just type alias? It will show what you have defined.

– fedorqui
Jul 23 '14 at 15:04





What if you just type alias? It will show what you have defined.

– fedorqui
Jul 23 '14 at 15:04




3




3





Your next question is now required to be about setting up a backup system. :-/

– derobert
Jul 23 '14 at 16:06





Your next question is now required to be about setting up a backup system. :-/

– derobert
Jul 23 '14 at 16:06




2




2





Your next task, as soon as you've recreated your .bash_aliases, is to set up version control for your dot files.

– Gilles
Jul 23 '14 at 23:02





Your next task, as soon as you've recreated your .bash_aliases, is to set up version control for your dot files.

– Gilles
Jul 23 '14 at 23:02













@Gilles even better: unix.blogoverflow.com/2014/04/…

– strugee
Jul 24 '14 at 5:26





@Gilles even better: unix.blogoverflow.com/2014/04/…

– strugee
Jul 24 '14 at 5:26










2 Answers
2






active

oldest

votes


















10














You can almost definitely just do:



alias >>./bash_aliases





share|improve this answer































    15














    Easy trick



    for alias in $(compgen -a); do type $alias; done





    share|improve this answer



















    • 4





      You, sir or madame, are a life saver.

      – MrUser
      Jul 23 '14 at 13:06






    • 1





      Combine this with redirection to a file ($alias > .bash_aliases, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)

      – trysis
      Jul 23 '14 at 18:12













    • While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.

      – moopet
      Jul 24 '14 at 8:01











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f146109%2fhow-to-retrieve-lost-aliases%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    10














    You can almost definitely just do:



    alias >>./bash_aliases





    share|improve this answer




























      10














      You can almost definitely just do:



      alias >>./bash_aliases





      share|improve this answer


























        10












        10








        10







        You can almost definitely just do:



        alias >>./bash_aliases





        share|improve this answer













        You can almost definitely just do:



        alias >>./bash_aliases






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 23 '14 at 14:27









        mikeservmikeserv

        45.5k668155




        45.5k668155

























            15














            Easy trick



            for alias in $(compgen -a); do type $alias; done





            share|improve this answer



















            • 4





              You, sir or madame, are a life saver.

              – MrUser
              Jul 23 '14 at 13:06






            • 1





              Combine this with redirection to a file ($alias > .bash_aliases, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)

              – trysis
              Jul 23 '14 at 18:12













            • While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.

              – moopet
              Jul 24 '14 at 8:01
















            15














            Easy trick



            for alias in $(compgen -a); do type $alias; done





            share|improve this answer



















            • 4





              You, sir or madame, are a life saver.

              – MrUser
              Jul 23 '14 at 13:06






            • 1





              Combine this with redirection to a file ($alias > .bash_aliases, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)

              – trysis
              Jul 23 '14 at 18:12













            • While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.

              – moopet
              Jul 24 '14 at 8:01














            15












            15








            15







            Easy trick



            for alias in $(compgen -a); do type $alias; done





            share|improve this answer













            Easy trick



            for alias in $(compgen -a); do type $alias; done






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 23 '14 at 13:03









            dchirikovdchirikov

            2,89811015




            2,89811015








            • 4





              You, sir or madame, are a life saver.

              – MrUser
              Jul 23 '14 at 13:06






            • 1





              Combine this with redirection to a file ($alias > .bash_aliases, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)

              – trysis
              Jul 23 '14 at 18:12













            • While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.

              – moopet
              Jul 24 '14 at 8:01














            • 4





              You, sir or madame, are a life saver.

              – MrUser
              Jul 23 '14 at 13:06






            • 1





              Combine this with redirection to a file ($alias > .bash_aliases, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)

              – trysis
              Jul 23 '14 at 18:12













            • While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.

              – moopet
              Jul 24 '14 at 8:01








            4




            4





            You, sir or madame, are a life saver.

            – MrUser
            Jul 23 '14 at 13:06





            You, sir or madame, are a life saver.

            – MrUser
            Jul 23 '14 at 13:06




            1




            1





            Combine this with redirection to a file ($alias > .bash_aliases, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)

            – trysis
            Jul 23 '14 at 18:12







            Combine this with redirection to a file ($alias > .bash_aliases, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)

            – trysis
            Jul 23 '14 at 18:12















            While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.

            – moopet
            Jul 24 '14 at 8:01





            While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.

            – moopet
            Jul 24 '14 at 8:01


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f146109%2fhow-to-retrieve-lost-aliases%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

            Loup dans la culture

            How to solve the problem of ntp “Unable to contact time server” from KDE?

            ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux