Why does ls wrap some filenames in single quotes?











up vote
2
down vote

favorite












I've noticed that when I do ls in a terminal, some filenames are wrapped in single quotes and some aren't.



I don't like the way this looks as I prefer my terminal outputs to be nice and uniform. What causes this functionality, and is it possible to safely disable it?



enter image description here










share|improve this question


























    up vote
    2
    down vote

    favorite












    I've noticed that when I do ls in a terminal, some filenames are wrapped in single quotes and some aren't.



    I don't like the way this looks as I prefer my terminal outputs to be nice and uniform. What causes this functionality, and is it possible to safely disable it?



    enter image description here










    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I've noticed that when I do ls in a terminal, some filenames are wrapped in single quotes and some aren't.



      I don't like the way this looks as I prefer my terminal outputs to be nice and uniform. What causes this functionality, and is it possible to safely disable it?



      enter image description here










      share|improve this question













      I've noticed that when I do ls in a terminal, some filenames are wrapped in single quotes and some aren't.



      I don't like the way this looks as I prefer my terminal outputs to be nice and uniform. What causes this functionality, and is it possible to safely disable it?



      enter image description here







      linux unix cygwin ls coreutils






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 18 at 1:11









      Hashim

      2,83962852




      2,83962852






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          Why ls wraps some filenames in single quotes



          What's actually happening here is that ls wraps single quotes around filenames with spaces in them, for the purpose of allowing the filenames to be immediately copy-pasted into another command or script (i.e. without breaking it):



          enter image description here



          This was a highly unpopular feature introduced to version 8.25 of the coreutils package in early 2016, by a consensus of just three developers.



          Arguments cited by critics of the change include that it makes the output of ls look considerably more unsightly, unnecessarily diverges from nearly half a century of Unix tradition, and due to the way it was implemented (opt-out instead of opt-in) breaks compatibility with long-standing existing scripts and utilities.



          Because the feature was introduced to the coreutils package - which virtually every Linux distribution depends on and which ls is a part of - the change affects every Linux or Linux-like system imaginable, from Arch Linux to Cygwin.



          In the case of Debian and Debian-derived distros like Ubuntu, the change was at some point reverted after considerable protest, before being once again reinstated in October 2017.



          As this answer makes clear, the best way to register your disappointment at this change would be to contact the coreutils developers directly via a bug report and (politely) make the argument that they've made a huge mistake. As per the open source ethos, a critical mass of users respectfully but adamantly insisting that the way ls used to behave be properly reinstated should in theory be enough to convince the coreutils developers to listen to the Linux community.



          In the more short-term, pragmatic sense, there are several ways you can restore ls' pre-version 8.25 behaviour of leaving all output intact. Below are three methods to doing so for the bash shell.





          Restoring ls' pre-version 8.25 behaviour



          Set the QUOTING_STYLE environment variable to literal in your ~/.bashrc file



          Find your ~/.bashrc file in your HOME folder (/home/yourusername), and add the following line to it:



          export QUOTING_STYLE=literal


          Save the file, and the change should apply immediately to all new bash terminals that you open.



          You can also run source ~/.bashrc to have the changes be pushed to any terminal windows that were open at the time of making the change.



          Create an alias to ls -N



          If you prefer aliases to environment variables, you can also create an alias in .bashrc that uses 8.25's new -N switch. From ls --help:




          -N, --literal print entry names without quoting




          To do this, add the following line to your ~/.bashrc file and save it:



          alias ls="ls -N"


          Run source ~/.bashrc to have the new change be pushed to all open terminals.



          Use the -N command-line switch (for the current run only)



          If you prefer coreutils' new default behaviour but want to bypass it temporarily, you can also use the -N switch directly in a command:



          ls -N





          share|improve this answer



















          • 1




            It was not my intention to be passive-aggressive, but since you perceived my comment as such, maybe I was. My apologies then, comment deleted. I genuinely upvoted the answer and the question, this means I think they are useful here on SU.
            – Kamil Maciorowski
            Nov 18 at 2:42











          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%2f1376351%2fwhy-does-ls-wrap-some-filenames-in-single-quotes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          4
          down vote



          accepted










          Why ls wraps some filenames in single quotes



          What's actually happening here is that ls wraps single quotes around filenames with spaces in them, for the purpose of allowing the filenames to be immediately copy-pasted into another command or script (i.e. without breaking it):



          enter image description here



          This was a highly unpopular feature introduced to version 8.25 of the coreutils package in early 2016, by a consensus of just three developers.



          Arguments cited by critics of the change include that it makes the output of ls look considerably more unsightly, unnecessarily diverges from nearly half a century of Unix tradition, and due to the way it was implemented (opt-out instead of opt-in) breaks compatibility with long-standing existing scripts and utilities.



          Because the feature was introduced to the coreutils package - which virtually every Linux distribution depends on and which ls is a part of - the change affects every Linux or Linux-like system imaginable, from Arch Linux to Cygwin.



          In the case of Debian and Debian-derived distros like Ubuntu, the change was at some point reverted after considerable protest, before being once again reinstated in October 2017.



          As this answer makes clear, the best way to register your disappointment at this change would be to contact the coreutils developers directly via a bug report and (politely) make the argument that they've made a huge mistake. As per the open source ethos, a critical mass of users respectfully but adamantly insisting that the way ls used to behave be properly reinstated should in theory be enough to convince the coreutils developers to listen to the Linux community.



          In the more short-term, pragmatic sense, there are several ways you can restore ls' pre-version 8.25 behaviour of leaving all output intact. Below are three methods to doing so for the bash shell.





          Restoring ls' pre-version 8.25 behaviour



          Set the QUOTING_STYLE environment variable to literal in your ~/.bashrc file



          Find your ~/.bashrc file in your HOME folder (/home/yourusername), and add the following line to it:



          export QUOTING_STYLE=literal


          Save the file, and the change should apply immediately to all new bash terminals that you open.



          You can also run source ~/.bashrc to have the changes be pushed to any terminal windows that were open at the time of making the change.



          Create an alias to ls -N



          If you prefer aliases to environment variables, you can also create an alias in .bashrc that uses 8.25's new -N switch. From ls --help:




          -N, --literal print entry names without quoting




          To do this, add the following line to your ~/.bashrc file and save it:



          alias ls="ls -N"


          Run source ~/.bashrc to have the new change be pushed to all open terminals.



          Use the -N command-line switch (for the current run only)



          If you prefer coreutils' new default behaviour but want to bypass it temporarily, you can also use the -N switch directly in a command:



          ls -N





          share|improve this answer



















          • 1




            It was not my intention to be passive-aggressive, but since you perceived my comment as such, maybe I was. My apologies then, comment deleted. I genuinely upvoted the answer and the question, this means I think they are useful here on SU.
            – Kamil Maciorowski
            Nov 18 at 2:42















          up vote
          4
          down vote



          accepted










          Why ls wraps some filenames in single quotes



          What's actually happening here is that ls wraps single quotes around filenames with spaces in them, for the purpose of allowing the filenames to be immediately copy-pasted into another command or script (i.e. without breaking it):



          enter image description here



          This was a highly unpopular feature introduced to version 8.25 of the coreutils package in early 2016, by a consensus of just three developers.



          Arguments cited by critics of the change include that it makes the output of ls look considerably more unsightly, unnecessarily diverges from nearly half a century of Unix tradition, and due to the way it was implemented (opt-out instead of opt-in) breaks compatibility with long-standing existing scripts and utilities.



          Because the feature was introduced to the coreutils package - which virtually every Linux distribution depends on and which ls is a part of - the change affects every Linux or Linux-like system imaginable, from Arch Linux to Cygwin.



          In the case of Debian and Debian-derived distros like Ubuntu, the change was at some point reverted after considerable protest, before being once again reinstated in October 2017.



          As this answer makes clear, the best way to register your disappointment at this change would be to contact the coreutils developers directly via a bug report and (politely) make the argument that they've made a huge mistake. As per the open source ethos, a critical mass of users respectfully but adamantly insisting that the way ls used to behave be properly reinstated should in theory be enough to convince the coreutils developers to listen to the Linux community.



          In the more short-term, pragmatic sense, there are several ways you can restore ls' pre-version 8.25 behaviour of leaving all output intact. Below are three methods to doing so for the bash shell.





          Restoring ls' pre-version 8.25 behaviour



          Set the QUOTING_STYLE environment variable to literal in your ~/.bashrc file



          Find your ~/.bashrc file in your HOME folder (/home/yourusername), and add the following line to it:



          export QUOTING_STYLE=literal


          Save the file, and the change should apply immediately to all new bash terminals that you open.



          You can also run source ~/.bashrc to have the changes be pushed to any terminal windows that were open at the time of making the change.



          Create an alias to ls -N



          If you prefer aliases to environment variables, you can also create an alias in .bashrc that uses 8.25's new -N switch. From ls --help:




          -N, --literal print entry names without quoting




          To do this, add the following line to your ~/.bashrc file and save it:



          alias ls="ls -N"


          Run source ~/.bashrc to have the new change be pushed to all open terminals.



          Use the -N command-line switch (for the current run only)



          If you prefer coreutils' new default behaviour but want to bypass it temporarily, you can also use the -N switch directly in a command:



          ls -N





          share|improve this answer



















          • 1




            It was not my intention to be passive-aggressive, but since you perceived my comment as such, maybe I was. My apologies then, comment deleted. I genuinely upvoted the answer and the question, this means I think they are useful here on SU.
            – Kamil Maciorowski
            Nov 18 at 2:42













          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          Why ls wraps some filenames in single quotes



          What's actually happening here is that ls wraps single quotes around filenames with spaces in them, for the purpose of allowing the filenames to be immediately copy-pasted into another command or script (i.e. without breaking it):



          enter image description here



          This was a highly unpopular feature introduced to version 8.25 of the coreutils package in early 2016, by a consensus of just three developers.



          Arguments cited by critics of the change include that it makes the output of ls look considerably more unsightly, unnecessarily diverges from nearly half a century of Unix tradition, and due to the way it was implemented (opt-out instead of opt-in) breaks compatibility with long-standing existing scripts and utilities.



          Because the feature was introduced to the coreutils package - which virtually every Linux distribution depends on and which ls is a part of - the change affects every Linux or Linux-like system imaginable, from Arch Linux to Cygwin.



          In the case of Debian and Debian-derived distros like Ubuntu, the change was at some point reverted after considerable protest, before being once again reinstated in October 2017.



          As this answer makes clear, the best way to register your disappointment at this change would be to contact the coreutils developers directly via a bug report and (politely) make the argument that they've made a huge mistake. As per the open source ethos, a critical mass of users respectfully but adamantly insisting that the way ls used to behave be properly reinstated should in theory be enough to convince the coreutils developers to listen to the Linux community.



          In the more short-term, pragmatic sense, there are several ways you can restore ls' pre-version 8.25 behaviour of leaving all output intact. Below are three methods to doing so for the bash shell.





          Restoring ls' pre-version 8.25 behaviour



          Set the QUOTING_STYLE environment variable to literal in your ~/.bashrc file



          Find your ~/.bashrc file in your HOME folder (/home/yourusername), and add the following line to it:



          export QUOTING_STYLE=literal


          Save the file, and the change should apply immediately to all new bash terminals that you open.



          You can also run source ~/.bashrc to have the changes be pushed to any terminal windows that were open at the time of making the change.



          Create an alias to ls -N



          If you prefer aliases to environment variables, you can also create an alias in .bashrc that uses 8.25's new -N switch. From ls --help:




          -N, --literal print entry names without quoting




          To do this, add the following line to your ~/.bashrc file and save it:



          alias ls="ls -N"


          Run source ~/.bashrc to have the new change be pushed to all open terminals.



          Use the -N command-line switch (for the current run only)



          If you prefer coreutils' new default behaviour but want to bypass it temporarily, you can also use the -N switch directly in a command:



          ls -N





          share|improve this answer














          Why ls wraps some filenames in single quotes



          What's actually happening here is that ls wraps single quotes around filenames with spaces in them, for the purpose of allowing the filenames to be immediately copy-pasted into another command or script (i.e. without breaking it):



          enter image description here



          This was a highly unpopular feature introduced to version 8.25 of the coreutils package in early 2016, by a consensus of just three developers.



          Arguments cited by critics of the change include that it makes the output of ls look considerably more unsightly, unnecessarily diverges from nearly half a century of Unix tradition, and due to the way it was implemented (opt-out instead of opt-in) breaks compatibility with long-standing existing scripts and utilities.



          Because the feature was introduced to the coreutils package - which virtually every Linux distribution depends on and which ls is a part of - the change affects every Linux or Linux-like system imaginable, from Arch Linux to Cygwin.



          In the case of Debian and Debian-derived distros like Ubuntu, the change was at some point reverted after considerable protest, before being once again reinstated in October 2017.



          As this answer makes clear, the best way to register your disappointment at this change would be to contact the coreutils developers directly via a bug report and (politely) make the argument that they've made a huge mistake. As per the open source ethos, a critical mass of users respectfully but adamantly insisting that the way ls used to behave be properly reinstated should in theory be enough to convince the coreutils developers to listen to the Linux community.



          In the more short-term, pragmatic sense, there are several ways you can restore ls' pre-version 8.25 behaviour of leaving all output intact. Below are three methods to doing so for the bash shell.





          Restoring ls' pre-version 8.25 behaviour



          Set the QUOTING_STYLE environment variable to literal in your ~/.bashrc file



          Find your ~/.bashrc file in your HOME folder (/home/yourusername), and add the following line to it:



          export QUOTING_STYLE=literal


          Save the file, and the change should apply immediately to all new bash terminals that you open.



          You can also run source ~/.bashrc to have the changes be pushed to any terminal windows that were open at the time of making the change.



          Create an alias to ls -N



          If you prefer aliases to environment variables, you can also create an alias in .bashrc that uses 8.25's new -N switch. From ls --help:




          -N, --literal print entry names without quoting




          To do this, add the following line to your ~/.bashrc file and save it:



          alias ls="ls -N"


          Run source ~/.bashrc to have the new change be pushed to all open terminals.



          Use the -N command-line switch (for the current run only)



          If you prefer coreutils' new default behaviour but want to bypass it temporarily, you can also use the -N switch directly in a command:



          ls -N






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 18 at 1:17

























          answered Nov 18 at 1:11









          Hashim

          2,83962852




          2,83962852








          • 1




            It was not my intention to be passive-aggressive, but since you perceived my comment as such, maybe I was. My apologies then, comment deleted. I genuinely upvoted the answer and the question, this means I think they are useful here on SU.
            – Kamil Maciorowski
            Nov 18 at 2:42














          • 1




            It was not my intention to be passive-aggressive, but since you perceived my comment as such, maybe I was. My apologies then, comment deleted. I genuinely upvoted the answer and the question, this means I think they are useful here on SU.
            – Kamil Maciorowski
            Nov 18 at 2:42








          1




          1




          It was not my intention to be passive-aggressive, but since you perceived my comment as such, maybe I was. My apologies then, comment deleted. I genuinely upvoted the answer and the question, this means I think they are useful here on SU.
          – Kamil Maciorowski
          Nov 18 at 2:42




          It was not my intention to be passive-aggressive, but since you perceived my comment as such, maybe I was. My apologies then, comment deleted. I genuinely upvoted the answer and the question, this means I think they are useful here on SU.
          – Kamil Maciorowski
          Nov 18 at 2:42


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1376351%2fwhy-does-ls-wrap-some-filenames-in-single-quotes%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

          AnyDesk - Fatal Program Failure

          How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

          QoS: MAC-Priority for clients behind a repeater