How to make `ls` color its output by default, without setting up an alias?











up vote
35
down vote

favorite
6












I don't want an alias (alias ls='ls --color'), and I had previously set this up on Mac OSX using CLICOLOR environment variable which magically brought colors to ls. Now I am on Linux (Arch x86-64) with xterm and a really basic setup, and I can't make ls output color (using ls verbatim). I do get color when using --color switch.



Is there no way to achieve this? POSIX compliance would be nice :-)










share|improve this question


























    up vote
    35
    down vote

    favorite
    6












    I don't want an alias (alias ls='ls --color'), and I had previously set this up on Mac OSX using CLICOLOR environment variable which magically brought colors to ls. Now I am on Linux (Arch x86-64) with xterm and a really basic setup, and I can't make ls output color (using ls verbatim). I do get color when using --color switch.



    Is there no way to achieve this? POSIX compliance would be nice :-)










    share|improve this question
























      up vote
      35
      down vote

      favorite
      6









      up vote
      35
      down vote

      favorite
      6






      6





      I don't want an alias (alias ls='ls --color'), and I had previously set this up on Mac OSX using CLICOLOR environment variable which magically brought colors to ls. Now I am on Linux (Arch x86-64) with xterm and a really basic setup, and I can't make ls output color (using ls verbatim). I do get color when using --color switch.



      Is there no way to achieve this? POSIX compliance would be nice :-)










      share|improve this question













      I don't want an alias (alias ls='ls --color'), and I had previously set this up on Mac OSX using CLICOLOR environment variable which magically brought colors to ls. Now I am on Linux (Arch x86-64) with xterm and a really basic setup, and I can't make ls output color (using ls verbatim). I do get color when using --color switch.



      Is there no way to achieve this? POSIX compliance would be nice :-)







      linux ls xterm






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 25 '13 at 12:46









      amn

      64231833




      64231833






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          52
          down vote



          accepted










          There is no way: the ls man page will show you that the default setting (for --color) is 'none' - ie. never use colour.



          Any reason you don't want to use aliases? I'm a recovering Red Hat user, so every time I install a new distribution I set three ls aliases like so:



          ## Colorize the ls output ##
          alias ls='ls --color=auto'

          ## Use a long listing format ##
          alias ll='ls -la'

          ## Show hidden files ##
          alias l.='ls -d .* --color=auto'





          share|improve this answer

















          • 2




            No reason I cannot - I was on Mac OSX the other day, and it supported the CLICOLOR which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
            – amn
            Oct 28 '13 at 10:25






          • 11




            On Mac OSX you can use alias ls='ls -G'
            – Gal Bracha
            Aug 6 '17 at 13:44








          • 1




            also add alias grep='grep --color' to it ;)
            – TechJS
            Jul 7 at 4:46


















          up vote
          -2
          down vote













          if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors






          share|improve this answer

















          • 1




            This is incorrect.
            – Scott
            Nov 24 at 23:49











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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: 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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f665274%2fhow-to-make-ls-color-its-output-by-default-without-setting-up-an-alias%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








          up vote
          52
          down vote



          accepted










          There is no way: the ls man page will show you that the default setting (for --color) is 'none' - ie. never use colour.



          Any reason you don't want to use aliases? I'm a recovering Red Hat user, so every time I install a new distribution I set three ls aliases like so:



          ## Colorize the ls output ##
          alias ls='ls --color=auto'

          ## Use a long listing format ##
          alias ll='ls -la'

          ## Show hidden files ##
          alias l.='ls -d .* --color=auto'





          share|improve this answer

















          • 2




            No reason I cannot - I was on Mac OSX the other day, and it supported the CLICOLOR which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
            – amn
            Oct 28 '13 at 10:25






          • 11




            On Mac OSX you can use alias ls='ls -G'
            – Gal Bracha
            Aug 6 '17 at 13:44








          • 1




            also add alias grep='grep --color' to it ;)
            – TechJS
            Jul 7 at 4:46















          up vote
          52
          down vote



          accepted










          There is no way: the ls man page will show you that the default setting (for --color) is 'none' - ie. never use colour.



          Any reason you don't want to use aliases? I'm a recovering Red Hat user, so every time I install a new distribution I set three ls aliases like so:



          ## Colorize the ls output ##
          alias ls='ls --color=auto'

          ## Use a long listing format ##
          alias ll='ls -la'

          ## Show hidden files ##
          alias l.='ls -d .* --color=auto'





          share|improve this answer

















          • 2




            No reason I cannot - I was on Mac OSX the other day, and it supported the CLICOLOR which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
            – amn
            Oct 28 '13 at 10:25






          • 11




            On Mac OSX you can use alias ls='ls -G'
            – Gal Bracha
            Aug 6 '17 at 13:44








          • 1




            also add alias grep='grep --color' to it ;)
            – TechJS
            Jul 7 at 4:46













          up vote
          52
          down vote



          accepted







          up vote
          52
          down vote



          accepted






          There is no way: the ls man page will show you that the default setting (for --color) is 'none' - ie. never use colour.



          Any reason you don't want to use aliases? I'm a recovering Red Hat user, so every time I install a new distribution I set three ls aliases like so:



          ## Colorize the ls output ##
          alias ls='ls --color=auto'

          ## Use a long listing format ##
          alias ll='ls -la'

          ## Show hidden files ##
          alias l.='ls -d .* --color=auto'





          share|improve this answer












          There is no way: the ls man page will show you that the default setting (for --color) is 'none' - ie. never use colour.



          Any reason you don't want to use aliases? I'm a recovering Red Hat user, so every time I install a new distribution I set three ls aliases like so:



          ## Colorize the ls output ##
          alias ls='ls --color=auto'

          ## Use a long listing format ##
          alias ll='ls -la'

          ## Show hidden files ##
          alias l.='ls -d .* --color=auto'






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 25 '13 at 13:03









          pdah

          70664




          70664








          • 2




            No reason I cannot - I was on Mac OSX the other day, and it supported the CLICOLOR which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
            – amn
            Oct 28 '13 at 10:25






          • 11




            On Mac OSX you can use alias ls='ls -G'
            – Gal Bracha
            Aug 6 '17 at 13:44








          • 1




            also add alias grep='grep --color' to it ;)
            – TechJS
            Jul 7 at 4:46














          • 2




            No reason I cannot - I was on Mac OSX the other day, and it supported the CLICOLOR which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
            – amn
            Oct 28 '13 at 10:25






          • 11




            On Mac OSX you can use alias ls='ls -G'
            – Gal Bracha
            Aug 6 '17 at 13:44








          • 1




            also add alias grep='grep --color' to it ;)
            – TechJS
            Jul 7 at 4:46








          2




          2




          No reason I cannot - I was on Mac OSX the other day, and it supported the CLICOLOR which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
          – amn
          Oct 28 '13 at 10:25




          No reason I cannot - I was on Mac OSX the other day, and it supported the CLICOLOR which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
          – amn
          Oct 28 '13 at 10:25




          11




          11




          On Mac OSX you can use alias ls='ls -G'
          – Gal Bracha
          Aug 6 '17 at 13:44






          On Mac OSX you can use alias ls='ls -G'
          – Gal Bracha
          Aug 6 '17 at 13:44






          1




          1




          also add alias grep='grep --color' to it ;)
          – TechJS
          Jul 7 at 4:46




          also add alias grep='grep --color' to it ;)
          – TechJS
          Jul 7 at 4:46












          up vote
          -2
          down vote













          if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors






          share|improve this answer

















          • 1




            This is incorrect.
            – Scott
            Nov 24 at 23:49















          up vote
          -2
          down vote













          if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors






          share|improve this answer

















          • 1




            This is incorrect.
            – Scott
            Nov 24 at 23:49













          up vote
          -2
          down vote










          up vote
          -2
          down vote









          if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors






          share|improve this answer












          if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 24 at 23:21









          Mark

          1




          1








          • 1




            This is incorrect.
            – Scott
            Nov 24 at 23:49














          • 1




            This is incorrect.
            – Scott
            Nov 24 at 23:49








          1




          1




          This is incorrect.
          – Scott
          Nov 24 at 23:49




          This is incorrect.
          – Scott
          Nov 24 at 23:49


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2fsuperuser.com%2fquestions%2f665274%2fhow-to-make-ls-color-its-output-by-default-without-setting-up-an-alias%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

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          RAC Tourist Trophy