Overriding a distro-dependent Bash alias to act a bit different

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












In Ubuntu 16.04 I've added the following code to /etc/bash.bashrc:



alias ll="ls -la --group-directories-first"


I then rebooted.



Note: I used /etc/bash.bashrc because I needed all aliases whatsoever in the one file and available for all users.




My intention was to rewrite the "native" ll alias. Yet it wasn't changed; if I go to any dir that includes dirs and files, and I execute ll, I get a list without dirs being sorted above files. In other words.



What did I do wrong?










share|improve this question



























    up vote
    2
    down vote

    favorite












    In Ubuntu 16.04 I've added the following code to /etc/bash.bashrc:



    alias ll="ls -la --group-directories-first"


    I then rebooted.



    Note: I used /etc/bash.bashrc because I needed all aliases whatsoever in the one file and available for all users.




    My intention was to rewrite the "native" ll alias. Yet it wasn't changed; if I go to any dir that includes dirs and files, and I execute ll, I get a list without dirs being sorted above files. In other words.



    What did I do wrong?










    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      In Ubuntu 16.04 I've added the following code to /etc/bash.bashrc:



      alias ll="ls -la --group-directories-first"


      I then rebooted.



      Note: I used /etc/bash.bashrc because I needed all aliases whatsoever in the one file and available for all users.




      My intention was to rewrite the "native" ll alias. Yet it wasn't changed; if I go to any dir that includes dirs and files, and I execute ll, I get a list without dirs being sorted above files. In other words.



      What did I do wrong?










      share|improve this question















      In Ubuntu 16.04 I've added the following code to /etc/bash.bashrc:



      alias ll="ls -la --group-directories-first"


      I then rebooted.



      Note: I used /etc/bash.bashrc because I needed all aliases whatsoever in the one file and available for all users.




      My intention was to rewrite the "native" ll alias. Yet it wasn't changed; if I go to any dir that includes dirs and files, and I execute ll, I get a list without dirs being sorted above files. In other words.



      What did I do wrong?







      alias bashrc






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 22 at 8:30

























      asked Aug 9 '17 at 16:27









      JohnDoea

      82726




      82726




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          The ll alias is defined in the default .bashrc.



          An alias definition is a command. Bash is an imperative language, it executes commands one after the other. If there are multiple definitions for the same alias, the alias is redefined each time the shell executes one of the definitions. Thus the last definition wins.



          When bash starts, it reads the system file /etc/bash.bashrc before the user file ~/.bashrc. Thus a definition in ~/.bashrc overrides any definition of the same alias in /etc/bash.bashrc. You can't (sanely) do anything in /etc/bash.bashrc to prevent a redefinition in ~/.bashrc.



          It doesn't make sense to impose convenience aliases on users. That's why ll is defined in ~/.bashrc and not in /etc/bash.bashrc. So instead of putting your preferred definition in the system file, put it in your user file.



          You could change the default .bashrc — that's /etc/skel/.bashrc. This file is copied to a user's home directory when the user's account is created. Changing a file in /etc/skel has no impact on already-existing accounts. But even that is not a good idea since what you're defining is a personal preference.






          share|improve this answer



























            up vote
            2
            down vote













            /etc/bash.bashrc applies to all users



            ~/.bashrc only applies to the user in which home folder it is.



            So, if you change the alias ll in /etc/bash.bashrc and run ll, you will get the output of the alias defined in ~/.bashrc, that is because ~/.bashrc has precedence over the definition in /etc/bash.bashrc.



            To put it simply; Add new aliases in /etc/bash.bashrc, but for rewrites, change ~/.bashrc.



            Edit:



            If you really want to have it all in one file, remove all aliases from all ~/.bashrc ~/.bash_profile and/or ~/.profile files of all users, then add all the aliases to /etc/bash.bashrc this will create a global alias configuration without any issues.



            Edit 2:



            Create or edit /etc/skel/.bashrc and copy your default .bashrc config, so that when you create a new user, there are no default aliases set.



            Thank you @user4556274 for the edit suggestion.






            share|improve this answer


















            • 2




              @Benia, if you are the only user on your system, put all changes in ~/.bashrc. /etc/bash.bashrc is for settings that are to be shared among all users; then individual users may add additional (or override) settings in their personal ~/.bashrc.
              – user4556274
              Aug 9 '17 at 16:49






            • 2




              Definitely DO NOT source .profile from /etc/bash.bashrc or any file with rc in the name.
              – Jesse_b
              Aug 9 '17 at 16:52










            • Remove any ll aliases from ~/.bashrc ~/.bash_profile and/or ~/.profile for all users on the machine.
              – Jesse_b
              Aug 9 '17 at 16:55










            • I edited the answer, hopefully this will solve your question.
              – Hunter.S.Thompson
              Aug 9 '17 at 16:57






            • 1




              @Hunter.S.Thompson, note the OP should also modify /etc/skel/.bashrc (or the equivalent) to remove any aliases which should not be added to a new user's .bashrc when a new user is added to the system.
              – user4556274
              Aug 9 '17 at 16:59

















            up vote
            1
            down vote













            I'm fairly certain /etc/bash.bashrc isn't a thing. The file you are looking for is $HOME/.bash_profile OR $HOME/.profile Alternatively you could use $HOME/.bashrc but I think profile is the correct file for what you are trying to accomplish.



            For an explanation of the difference between .bash_profile and .bashrc please see: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html



            To source .profile from .bash_profile add the following to your .bash_profile:



            if [ -f ~/.profile ]; then
            . ~/.profile
            fi


            Another potential option would be to make ll into a function inside /etc/bash.bashrc instead of an alias which I believe the function will take precedence over any aliases set with the same name.



            ll () 

            ls -la --group-directories-first







            share|improve this answer






















            • Yea append that to the end of the file.
              – Hunter.S.Thompson
              Aug 9 '17 at 16:32






            • 1




              /etc/bash.bashrc is a thing for global settings. However, if ll is redefined in the user's .bashrc, that will take precedence over the definition in /etc/bash.bashrc
              – user4556274
              Aug 9 '17 at 16:34










            • @user4556274 On Mac and CentOS it's just /etc/bashrc
              – Jesse_b
              Aug 9 '17 at 16:36







            • 1




              @Jesse_b, yes, but the OP identified the system as Ubuntu 16.04
              – user4556274
              Aug 9 '17 at 16:38







            • 1




              . ~/.profile is the same as source ~/.profile Which essentially just executes all commands within that file in the current shell vs executing a script which runs all the commands in a new shell.
              – Jesse_b
              Aug 9 '17 at 16:54










            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f385009%2foverriding-a-distro-dependent-bash-alias-to-act-a-bit-different%23new-answer', 'question_page');

            );

            Post as a guest






























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            The ll alias is defined in the default .bashrc.



            An alias definition is a command. Bash is an imperative language, it executes commands one after the other. If there are multiple definitions for the same alias, the alias is redefined each time the shell executes one of the definitions. Thus the last definition wins.



            When bash starts, it reads the system file /etc/bash.bashrc before the user file ~/.bashrc. Thus a definition in ~/.bashrc overrides any definition of the same alias in /etc/bash.bashrc. You can't (sanely) do anything in /etc/bash.bashrc to prevent a redefinition in ~/.bashrc.



            It doesn't make sense to impose convenience aliases on users. That's why ll is defined in ~/.bashrc and not in /etc/bash.bashrc. So instead of putting your preferred definition in the system file, put it in your user file.



            You could change the default .bashrc — that's /etc/skel/.bashrc. This file is copied to a user's home directory when the user's account is created. Changing a file in /etc/skel has no impact on already-existing accounts. But even that is not a good idea since what you're defining is a personal preference.






            share|improve this answer
























              up vote
              3
              down vote



              accepted










              The ll alias is defined in the default .bashrc.



              An alias definition is a command. Bash is an imperative language, it executes commands one after the other. If there are multiple definitions for the same alias, the alias is redefined each time the shell executes one of the definitions. Thus the last definition wins.



              When bash starts, it reads the system file /etc/bash.bashrc before the user file ~/.bashrc. Thus a definition in ~/.bashrc overrides any definition of the same alias in /etc/bash.bashrc. You can't (sanely) do anything in /etc/bash.bashrc to prevent a redefinition in ~/.bashrc.



              It doesn't make sense to impose convenience aliases on users. That's why ll is defined in ~/.bashrc and not in /etc/bash.bashrc. So instead of putting your preferred definition in the system file, put it in your user file.



              You could change the default .bashrc — that's /etc/skel/.bashrc. This file is copied to a user's home directory when the user's account is created. Changing a file in /etc/skel has no impact on already-existing accounts. But even that is not a good idea since what you're defining is a personal preference.






              share|improve this answer






















                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                The ll alias is defined in the default .bashrc.



                An alias definition is a command. Bash is an imperative language, it executes commands one after the other. If there are multiple definitions for the same alias, the alias is redefined each time the shell executes one of the definitions. Thus the last definition wins.



                When bash starts, it reads the system file /etc/bash.bashrc before the user file ~/.bashrc. Thus a definition in ~/.bashrc overrides any definition of the same alias in /etc/bash.bashrc. You can't (sanely) do anything in /etc/bash.bashrc to prevent a redefinition in ~/.bashrc.



                It doesn't make sense to impose convenience aliases on users. That's why ll is defined in ~/.bashrc and not in /etc/bash.bashrc. So instead of putting your preferred definition in the system file, put it in your user file.



                You could change the default .bashrc — that's /etc/skel/.bashrc. This file is copied to a user's home directory when the user's account is created. Changing a file in /etc/skel has no impact on already-existing accounts. But even that is not a good idea since what you're defining is a personal preference.






                share|improve this answer












                The ll alias is defined in the default .bashrc.



                An alias definition is a command. Bash is an imperative language, it executes commands one after the other. If there are multiple definitions for the same alias, the alias is redefined each time the shell executes one of the definitions. Thus the last definition wins.



                When bash starts, it reads the system file /etc/bash.bashrc before the user file ~/.bashrc. Thus a definition in ~/.bashrc overrides any definition of the same alias in /etc/bash.bashrc. You can't (sanely) do anything in /etc/bash.bashrc to prevent a redefinition in ~/.bashrc.



                It doesn't make sense to impose convenience aliases on users. That's why ll is defined in ~/.bashrc and not in /etc/bash.bashrc. So instead of putting your preferred definition in the system file, put it in your user file.



                You could change the default .bashrc — that's /etc/skel/.bashrc. This file is copied to a user's home directory when the user's account is created. Changing a file in /etc/skel has no impact on already-existing accounts. But even that is not a good idea since what you're defining is a personal preference.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 9 '17 at 23:38









                Gilles

                512k12010151547




                512k12010151547






















                    up vote
                    2
                    down vote













                    /etc/bash.bashrc applies to all users



                    ~/.bashrc only applies to the user in which home folder it is.



                    So, if you change the alias ll in /etc/bash.bashrc and run ll, you will get the output of the alias defined in ~/.bashrc, that is because ~/.bashrc has precedence over the definition in /etc/bash.bashrc.



                    To put it simply; Add new aliases in /etc/bash.bashrc, but for rewrites, change ~/.bashrc.



                    Edit:



                    If you really want to have it all in one file, remove all aliases from all ~/.bashrc ~/.bash_profile and/or ~/.profile files of all users, then add all the aliases to /etc/bash.bashrc this will create a global alias configuration without any issues.



                    Edit 2:



                    Create or edit /etc/skel/.bashrc and copy your default .bashrc config, so that when you create a new user, there are no default aliases set.



                    Thank you @user4556274 for the edit suggestion.






                    share|improve this answer


















                    • 2




                      @Benia, if you are the only user on your system, put all changes in ~/.bashrc. /etc/bash.bashrc is for settings that are to be shared among all users; then individual users may add additional (or override) settings in their personal ~/.bashrc.
                      – user4556274
                      Aug 9 '17 at 16:49






                    • 2




                      Definitely DO NOT source .profile from /etc/bash.bashrc or any file with rc in the name.
                      – Jesse_b
                      Aug 9 '17 at 16:52










                    • Remove any ll aliases from ~/.bashrc ~/.bash_profile and/or ~/.profile for all users on the machine.
                      – Jesse_b
                      Aug 9 '17 at 16:55










                    • I edited the answer, hopefully this will solve your question.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:57






                    • 1




                      @Hunter.S.Thompson, note the OP should also modify /etc/skel/.bashrc (or the equivalent) to remove any aliases which should not be added to a new user's .bashrc when a new user is added to the system.
                      – user4556274
                      Aug 9 '17 at 16:59














                    up vote
                    2
                    down vote













                    /etc/bash.bashrc applies to all users



                    ~/.bashrc only applies to the user in which home folder it is.



                    So, if you change the alias ll in /etc/bash.bashrc and run ll, you will get the output of the alias defined in ~/.bashrc, that is because ~/.bashrc has precedence over the definition in /etc/bash.bashrc.



                    To put it simply; Add new aliases in /etc/bash.bashrc, but for rewrites, change ~/.bashrc.



                    Edit:



                    If you really want to have it all in one file, remove all aliases from all ~/.bashrc ~/.bash_profile and/or ~/.profile files of all users, then add all the aliases to /etc/bash.bashrc this will create a global alias configuration without any issues.



                    Edit 2:



                    Create or edit /etc/skel/.bashrc and copy your default .bashrc config, so that when you create a new user, there are no default aliases set.



                    Thank you @user4556274 for the edit suggestion.






                    share|improve this answer


















                    • 2




                      @Benia, if you are the only user on your system, put all changes in ~/.bashrc. /etc/bash.bashrc is for settings that are to be shared among all users; then individual users may add additional (or override) settings in their personal ~/.bashrc.
                      – user4556274
                      Aug 9 '17 at 16:49






                    • 2




                      Definitely DO NOT source .profile from /etc/bash.bashrc or any file with rc in the name.
                      – Jesse_b
                      Aug 9 '17 at 16:52










                    • Remove any ll aliases from ~/.bashrc ~/.bash_profile and/or ~/.profile for all users on the machine.
                      – Jesse_b
                      Aug 9 '17 at 16:55










                    • I edited the answer, hopefully this will solve your question.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:57






                    • 1




                      @Hunter.S.Thompson, note the OP should also modify /etc/skel/.bashrc (or the equivalent) to remove any aliases which should not be added to a new user's .bashrc when a new user is added to the system.
                      – user4556274
                      Aug 9 '17 at 16:59












                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    /etc/bash.bashrc applies to all users



                    ~/.bashrc only applies to the user in which home folder it is.



                    So, if you change the alias ll in /etc/bash.bashrc and run ll, you will get the output of the alias defined in ~/.bashrc, that is because ~/.bashrc has precedence over the definition in /etc/bash.bashrc.



                    To put it simply; Add new aliases in /etc/bash.bashrc, but for rewrites, change ~/.bashrc.



                    Edit:



                    If you really want to have it all in one file, remove all aliases from all ~/.bashrc ~/.bash_profile and/or ~/.profile files of all users, then add all the aliases to /etc/bash.bashrc this will create a global alias configuration without any issues.



                    Edit 2:



                    Create or edit /etc/skel/.bashrc and copy your default .bashrc config, so that when you create a new user, there are no default aliases set.



                    Thank you @user4556274 for the edit suggestion.






                    share|improve this answer














                    /etc/bash.bashrc applies to all users



                    ~/.bashrc only applies to the user in which home folder it is.



                    So, if you change the alias ll in /etc/bash.bashrc and run ll, you will get the output of the alias defined in ~/.bashrc, that is because ~/.bashrc has precedence over the definition in /etc/bash.bashrc.



                    To put it simply; Add new aliases in /etc/bash.bashrc, but for rewrites, change ~/.bashrc.



                    Edit:



                    If you really want to have it all in one file, remove all aliases from all ~/.bashrc ~/.bash_profile and/or ~/.profile files of all users, then add all the aliases to /etc/bash.bashrc this will create a global alias configuration without any issues.



                    Edit 2:



                    Create or edit /etc/skel/.bashrc and copy your default .bashrc config, so that when you create a new user, there are no default aliases set.



                    Thank you @user4556274 for the edit suggestion.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 9 '17 at 17:04

























                    answered Aug 9 '17 at 16:42









                    Hunter.S.Thompson

                    4,66931334




                    4,66931334







                    • 2




                      @Benia, if you are the only user on your system, put all changes in ~/.bashrc. /etc/bash.bashrc is for settings that are to be shared among all users; then individual users may add additional (or override) settings in their personal ~/.bashrc.
                      – user4556274
                      Aug 9 '17 at 16:49






                    • 2




                      Definitely DO NOT source .profile from /etc/bash.bashrc or any file with rc in the name.
                      – Jesse_b
                      Aug 9 '17 at 16:52










                    • Remove any ll aliases from ~/.bashrc ~/.bash_profile and/or ~/.profile for all users on the machine.
                      – Jesse_b
                      Aug 9 '17 at 16:55










                    • I edited the answer, hopefully this will solve your question.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:57






                    • 1




                      @Hunter.S.Thompson, note the OP should also modify /etc/skel/.bashrc (or the equivalent) to remove any aliases which should not be added to a new user's .bashrc when a new user is added to the system.
                      – user4556274
                      Aug 9 '17 at 16:59












                    • 2




                      @Benia, if you are the only user on your system, put all changes in ~/.bashrc. /etc/bash.bashrc is for settings that are to be shared among all users; then individual users may add additional (or override) settings in their personal ~/.bashrc.
                      – user4556274
                      Aug 9 '17 at 16:49






                    • 2




                      Definitely DO NOT source .profile from /etc/bash.bashrc or any file with rc in the name.
                      – Jesse_b
                      Aug 9 '17 at 16:52










                    • Remove any ll aliases from ~/.bashrc ~/.bash_profile and/or ~/.profile for all users on the machine.
                      – Jesse_b
                      Aug 9 '17 at 16:55










                    • I edited the answer, hopefully this will solve your question.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:57






                    • 1




                      @Hunter.S.Thompson, note the OP should also modify /etc/skel/.bashrc (or the equivalent) to remove any aliases which should not be added to a new user's .bashrc when a new user is added to the system.
                      – user4556274
                      Aug 9 '17 at 16:59







                    2




                    2




                    @Benia, if you are the only user on your system, put all changes in ~/.bashrc. /etc/bash.bashrc is for settings that are to be shared among all users; then individual users may add additional (or override) settings in their personal ~/.bashrc.
                    – user4556274
                    Aug 9 '17 at 16:49




                    @Benia, if you are the only user on your system, put all changes in ~/.bashrc. /etc/bash.bashrc is for settings that are to be shared among all users; then individual users may add additional (or override) settings in their personal ~/.bashrc.
                    – user4556274
                    Aug 9 '17 at 16:49




                    2




                    2




                    Definitely DO NOT source .profile from /etc/bash.bashrc or any file with rc in the name.
                    – Jesse_b
                    Aug 9 '17 at 16:52




                    Definitely DO NOT source .profile from /etc/bash.bashrc or any file with rc in the name.
                    – Jesse_b
                    Aug 9 '17 at 16:52












                    Remove any ll aliases from ~/.bashrc ~/.bash_profile and/or ~/.profile for all users on the machine.
                    – Jesse_b
                    Aug 9 '17 at 16:55




                    Remove any ll aliases from ~/.bashrc ~/.bash_profile and/or ~/.profile for all users on the machine.
                    – Jesse_b
                    Aug 9 '17 at 16:55












                    I edited the answer, hopefully this will solve your question.
                    – Hunter.S.Thompson
                    Aug 9 '17 at 16:57




                    I edited the answer, hopefully this will solve your question.
                    – Hunter.S.Thompson
                    Aug 9 '17 at 16:57




                    1




                    1




                    @Hunter.S.Thompson, note the OP should also modify /etc/skel/.bashrc (or the equivalent) to remove any aliases which should not be added to a new user's .bashrc when a new user is added to the system.
                    – user4556274
                    Aug 9 '17 at 16:59




                    @Hunter.S.Thompson, note the OP should also modify /etc/skel/.bashrc (or the equivalent) to remove any aliases which should not be added to a new user's .bashrc when a new user is added to the system.
                    – user4556274
                    Aug 9 '17 at 16:59










                    up vote
                    1
                    down vote













                    I'm fairly certain /etc/bash.bashrc isn't a thing. The file you are looking for is $HOME/.bash_profile OR $HOME/.profile Alternatively you could use $HOME/.bashrc but I think profile is the correct file for what you are trying to accomplish.



                    For an explanation of the difference between .bash_profile and .bashrc please see: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html



                    To source .profile from .bash_profile add the following to your .bash_profile:



                    if [ -f ~/.profile ]; then
                    . ~/.profile
                    fi


                    Another potential option would be to make ll into a function inside /etc/bash.bashrc instead of an alias which I believe the function will take precedence over any aliases set with the same name.



                    ll () 

                    ls -la --group-directories-first







                    share|improve this answer






















                    • Yea append that to the end of the file.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:32






                    • 1




                      /etc/bash.bashrc is a thing for global settings. However, if ll is redefined in the user's .bashrc, that will take precedence over the definition in /etc/bash.bashrc
                      – user4556274
                      Aug 9 '17 at 16:34










                    • @user4556274 On Mac and CentOS it's just /etc/bashrc
                      – Jesse_b
                      Aug 9 '17 at 16:36







                    • 1




                      @Jesse_b, yes, but the OP identified the system as Ubuntu 16.04
                      – user4556274
                      Aug 9 '17 at 16:38







                    • 1




                      . ~/.profile is the same as source ~/.profile Which essentially just executes all commands within that file in the current shell vs executing a script which runs all the commands in a new shell.
                      – Jesse_b
                      Aug 9 '17 at 16:54














                    up vote
                    1
                    down vote













                    I'm fairly certain /etc/bash.bashrc isn't a thing. The file you are looking for is $HOME/.bash_profile OR $HOME/.profile Alternatively you could use $HOME/.bashrc but I think profile is the correct file for what you are trying to accomplish.



                    For an explanation of the difference between .bash_profile and .bashrc please see: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html



                    To source .profile from .bash_profile add the following to your .bash_profile:



                    if [ -f ~/.profile ]; then
                    . ~/.profile
                    fi


                    Another potential option would be to make ll into a function inside /etc/bash.bashrc instead of an alias which I believe the function will take precedence over any aliases set with the same name.



                    ll () 

                    ls -la --group-directories-first







                    share|improve this answer






















                    • Yea append that to the end of the file.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:32






                    • 1




                      /etc/bash.bashrc is a thing for global settings. However, if ll is redefined in the user's .bashrc, that will take precedence over the definition in /etc/bash.bashrc
                      – user4556274
                      Aug 9 '17 at 16:34










                    • @user4556274 On Mac and CentOS it's just /etc/bashrc
                      – Jesse_b
                      Aug 9 '17 at 16:36







                    • 1




                      @Jesse_b, yes, but the OP identified the system as Ubuntu 16.04
                      – user4556274
                      Aug 9 '17 at 16:38







                    • 1




                      . ~/.profile is the same as source ~/.profile Which essentially just executes all commands within that file in the current shell vs executing a script which runs all the commands in a new shell.
                      – Jesse_b
                      Aug 9 '17 at 16:54












                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    I'm fairly certain /etc/bash.bashrc isn't a thing. The file you are looking for is $HOME/.bash_profile OR $HOME/.profile Alternatively you could use $HOME/.bashrc but I think profile is the correct file for what you are trying to accomplish.



                    For an explanation of the difference between .bash_profile and .bashrc please see: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html



                    To source .profile from .bash_profile add the following to your .bash_profile:



                    if [ -f ~/.profile ]; then
                    . ~/.profile
                    fi


                    Another potential option would be to make ll into a function inside /etc/bash.bashrc instead of an alias which I believe the function will take precedence over any aliases set with the same name.



                    ll () 

                    ls -la --group-directories-first







                    share|improve this answer














                    I'm fairly certain /etc/bash.bashrc isn't a thing. The file you are looking for is $HOME/.bash_profile OR $HOME/.profile Alternatively you could use $HOME/.bashrc but I think profile is the correct file for what you are trying to accomplish.



                    For an explanation of the difference between .bash_profile and .bashrc please see: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html



                    To source .profile from .bash_profile add the following to your .bash_profile:



                    if [ -f ~/.profile ]; then
                    . ~/.profile
                    fi


                    Another potential option would be to make ll into a function inside /etc/bash.bashrc instead of an alias which I believe the function will take precedence over any aliases set with the same name.



                    ll () 

                    ls -la --group-directories-first








                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 9 '17 at 16:57

























                    answered Aug 9 '17 at 16:29









                    Jesse_b

                    10.5k22660




                    10.5k22660











                    • Yea append that to the end of the file.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:32






                    • 1




                      /etc/bash.bashrc is a thing for global settings. However, if ll is redefined in the user's .bashrc, that will take precedence over the definition in /etc/bash.bashrc
                      – user4556274
                      Aug 9 '17 at 16:34










                    • @user4556274 On Mac and CentOS it's just /etc/bashrc
                      – Jesse_b
                      Aug 9 '17 at 16:36







                    • 1




                      @Jesse_b, yes, but the OP identified the system as Ubuntu 16.04
                      – user4556274
                      Aug 9 '17 at 16:38







                    • 1




                      . ~/.profile is the same as source ~/.profile Which essentially just executes all commands within that file in the current shell vs executing a script which runs all the commands in a new shell.
                      – Jesse_b
                      Aug 9 '17 at 16:54
















                    • Yea append that to the end of the file.
                      – Hunter.S.Thompson
                      Aug 9 '17 at 16:32






                    • 1




                      /etc/bash.bashrc is a thing for global settings. However, if ll is redefined in the user's .bashrc, that will take precedence over the definition in /etc/bash.bashrc
                      – user4556274
                      Aug 9 '17 at 16:34










                    • @user4556274 On Mac and CentOS it's just /etc/bashrc
                      – Jesse_b
                      Aug 9 '17 at 16:36







                    • 1




                      @Jesse_b, yes, but the OP identified the system as Ubuntu 16.04
                      – user4556274
                      Aug 9 '17 at 16:38







                    • 1




                      . ~/.profile is the same as source ~/.profile Which essentially just executes all commands within that file in the current shell vs executing a script which runs all the commands in a new shell.
                      – Jesse_b
                      Aug 9 '17 at 16:54















                    Yea append that to the end of the file.
                    – Hunter.S.Thompson
                    Aug 9 '17 at 16:32




                    Yea append that to the end of the file.
                    – Hunter.S.Thompson
                    Aug 9 '17 at 16:32




                    1




                    1




                    /etc/bash.bashrc is a thing for global settings. However, if ll is redefined in the user's .bashrc, that will take precedence over the definition in /etc/bash.bashrc
                    – user4556274
                    Aug 9 '17 at 16:34




                    /etc/bash.bashrc is a thing for global settings. However, if ll is redefined in the user's .bashrc, that will take precedence over the definition in /etc/bash.bashrc
                    – user4556274
                    Aug 9 '17 at 16:34












                    @user4556274 On Mac and CentOS it's just /etc/bashrc
                    – Jesse_b
                    Aug 9 '17 at 16:36





                    @user4556274 On Mac and CentOS it's just /etc/bashrc
                    – Jesse_b
                    Aug 9 '17 at 16:36





                    1




                    1




                    @Jesse_b, yes, but the OP identified the system as Ubuntu 16.04
                    – user4556274
                    Aug 9 '17 at 16:38





                    @Jesse_b, yes, but the OP identified the system as Ubuntu 16.04
                    – user4556274
                    Aug 9 '17 at 16:38





                    1




                    1




                    . ~/.profile is the same as source ~/.profile Which essentially just executes all commands within that file in the current shell vs executing a script which runs all the commands in a new shell.
                    – Jesse_b
                    Aug 9 '17 at 16:54




                    . ~/.profile is the same as source ~/.profile Which essentially just executes all commands within that file in the current shell vs executing a script which runs all the commands in a new shell.
                    – Jesse_b
                    Aug 9 '17 at 16:54

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f385009%2foverriding-a-distro-dependent-bash-alias-to-act-a-bit-different%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?