Why is there an extra space when I type “ls” in the Desktop directory?

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





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








27















Just out of curiosity, I was wondering if there is a reason for the extra space when I type ls in the Desktop directory. Compare...



~/Desktop$ ls
file1 file2 file3


...to...



~/Documents$ ls
file1 file2 file3


Notice that when I type ls on the Desktop I get an extra space at the beginning of the line (not part of the filename). I can't find any other example location where I get this extra space at the beginning of the line. Does anyone else get this? Is there a reason?



NB: I am using Ubuntu Bionic Beaver LTS release and the default terminal that ships with it.










share|improve this question
























  • I don't have this. If i create a file with just a space as the name (touch " ") I have two spaces in front.

    – RoVo
    Mar 7 at 8:33






  • 6





    Run ls -la instead or find -type f -printf "file: -%P-n" and provide the output. Likely there's a file with non-printable character. Coloring of files also potentially could affect it, so try ls or dir command

    – Sergiy Kolodyazhnyy
    Mar 7 at 8:39












  • I could not see any files with non-printable characters, when I tried your first 2 suggestions. I still have a space when I try ls but not when I use dir...

    – Bart
    Mar 7 at 10:14






  • 34





    Present your actual output.

    – Lightness Races in Orbit
    Mar 7 at 18:05

















27















Just out of curiosity, I was wondering if there is a reason for the extra space when I type ls in the Desktop directory. Compare...



~/Desktop$ ls
file1 file2 file3


...to...



~/Documents$ ls
file1 file2 file3


Notice that when I type ls on the Desktop I get an extra space at the beginning of the line (not part of the filename). I can't find any other example location where I get this extra space at the beginning of the line. Does anyone else get this? Is there a reason?



NB: I am using Ubuntu Bionic Beaver LTS release and the default terminal that ships with it.










share|improve this question
























  • I don't have this. If i create a file with just a space as the name (touch " ") I have two spaces in front.

    – RoVo
    Mar 7 at 8:33






  • 6





    Run ls -la instead or find -type f -printf "file: -%P-n" and provide the output. Likely there's a file with non-printable character. Coloring of files also potentially could affect it, so try ls or dir command

    – Sergiy Kolodyazhnyy
    Mar 7 at 8:39












  • I could not see any files with non-printable characters, when I tried your first 2 suggestions. I still have a space when I try ls but not when I use dir...

    – Bart
    Mar 7 at 10:14






  • 34





    Present your actual output.

    – Lightness Races in Orbit
    Mar 7 at 18:05













27












27








27


2






Just out of curiosity, I was wondering if there is a reason for the extra space when I type ls in the Desktop directory. Compare...



~/Desktop$ ls
file1 file2 file3


...to...



~/Documents$ ls
file1 file2 file3


Notice that when I type ls on the Desktop I get an extra space at the beginning of the line (not part of the filename). I can't find any other example location where I get this extra space at the beginning of the line. Does anyone else get this? Is there a reason?



NB: I am using Ubuntu Bionic Beaver LTS release and the default terminal that ships with it.










share|improve this question
















Just out of curiosity, I was wondering if there is a reason for the extra space when I type ls in the Desktop directory. Compare...



~/Desktop$ ls
file1 file2 file3


...to...



~/Documents$ ls
file1 file2 file3


Notice that when I type ls on the Desktop I get an extra space at the beginning of the line (not part of the filename). I can't find any other example location where I get this extra space at the beginning of the line. Does anyone else get this? Is there a reason?



NB: I am using Ubuntu Bionic Beaver LTS release and the default terminal that ships with it.







command-line gnome-terminal ls






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 10 at 7:47









RonJohn

404310




404310










asked Mar 7 at 8:29









BartBart

15526




15526












  • I don't have this. If i create a file with just a space as the name (touch " ") I have two spaces in front.

    – RoVo
    Mar 7 at 8:33






  • 6





    Run ls -la instead or find -type f -printf "file: -%P-n" and provide the output. Likely there's a file with non-printable character. Coloring of files also potentially could affect it, so try ls or dir command

    – Sergiy Kolodyazhnyy
    Mar 7 at 8:39












  • I could not see any files with non-printable characters, when I tried your first 2 suggestions. I still have a space when I try ls but not when I use dir...

    – Bart
    Mar 7 at 10:14






  • 34





    Present your actual output.

    – Lightness Races in Orbit
    Mar 7 at 18:05

















  • I don't have this. If i create a file with just a space as the name (touch " ") I have two spaces in front.

    – RoVo
    Mar 7 at 8:33






  • 6





    Run ls -la instead or find -type f -printf "file: -%P-n" and provide the output. Likely there's a file with non-printable character. Coloring of files also potentially could affect it, so try ls or dir command

    – Sergiy Kolodyazhnyy
    Mar 7 at 8:39












  • I could not see any files with non-printable characters, when I tried your first 2 suggestions. I still have a space when I try ls but not when I use dir...

    – Bart
    Mar 7 at 10:14






  • 34





    Present your actual output.

    – Lightness Races in Orbit
    Mar 7 at 18:05
















I don't have this. If i create a file with just a space as the name (touch " ") I have two spaces in front.

– RoVo
Mar 7 at 8:33





I don't have this. If i create a file with just a space as the name (touch " ") I have two spaces in front.

– RoVo
Mar 7 at 8:33




6




6





Run ls -la instead or find -type f -printf "file: -%P-n" and provide the output. Likely there's a file with non-printable character. Coloring of files also potentially could affect it, so try ls or dir command

– Sergiy Kolodyazhnyy
Mar 7 at 8:39






Run ls -la instead or find -type f -printf "file: -%P-n" and provide the output. Likely there's a file with non-printable character. Coloring of files also potentially could affect it, so try ls or dir command

– Sergiy Kolodyazhnyy
Mar 7 at 8:39














I could not see any files with non-printable characters, when I tried your first 2 suggestions. I still have a space when I try ls but not when I use dir...

– Bart
Mar 7 at 10:14





I could not see any files with non-printable characters, when I tried your first 2 suggestions. I still have a space when I try ls but not when I use dir...

– Bart
Mar 7 at 10:14




34




34





Present your actual output.

– Lightness Races in Orbit
Mar 7 at 18:05





Present your actual output.

– Lightness Races in Orbit
Mar 7 at 18:05










2 Answers
2






active

oldest

votes


















84














The extra space appears when you have file names in your directory needing ' around them (e.g. file names with spaces or other special characters).



~/mytmp$ ls
a 'file(abc)' proyecto3.csv test Test.sh
b 'file(ab,c?).mp4' rootfile Test1.txt Test.zip
F26 'file(abc?).mp4' scr Test2.test vowels
Feb guess script Test2.txt
'Feb 26 xx' hw something test.rar


After removing the 'strange' files I get:



~/mytmp$ ls
a guess proyecto3.csv script test Test2.txt Test.sh
b hw rootfile something Test1.txt test.rar Test.zip
F26 loop scr speak Test2.test testscript vowels





share|improve this answer























  • Thank you for the explanation - this sounds correct to me. What threw me is that the extra space at the beginning of the line does not necessarily have to be in front of the file that has the special characters. But I guess that this is done to make the presentation clearer in the terminal. Thanks again

    – Bart
    Mar 11 at 16:26


















53














I'm pretty sure file1 file2 file3 is not what's exactly shown on your screen. You omitted precious information (the actual filenames) that might easily be relevant.



My assumption is that you have a filename that contains a space or other special character.



Newer version of coreutils's ls quote such filenames, typically in single quotes. Plus, if there's at least one file requiring such quoting, it adds a space in front of all other filenames so that they align up "nicely" if they happen to be underneath each other, that is, the single quote mark (apostrophe) is ignored for alignment.



See --quoting-style and -N in the manual page of ls for some more details, and the section "Formatting the file names" in its info page for even more details. You might e.g. consider aliasing ls to ls -N.






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/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%2faskubuntu.com%2fquestions%2f1123706%2fwhy-is-there-an-extra-space-when-i-type-ls-in-the-desktop-directory%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









    84














    The extra space appears when you have file names in your directory needing ' around them (e.g. file names with spaces or other special characters).



    ~/mytmp$ ls
    a 'file(abc)' proyecto3.csv test Test.sh
    b 'file(ab,c?).mp4' rootfile Test1.txt Test.zip
    F26 'file(abc?).mp4' scr Test2.test vowels
    Feb guess script Test2.txt
    'Feb 26 xx' hw something test.rar


    After removing the 'strange' files I get:



    ~/mytmp$ ls
    a guess proyecto3.csv script test Test2.txt Test.sh
    b hw rootfile something Test1.txt test.rar Test.zip
    F26 loop scr speak Test2.test testscript vowels





    share|improve this answer























    • Thank you for the explanation - this sounds correct to me. What threw me is that the extra space at the beginning of the line does not necessarily have to be in front of the file that has the special characters. But I guess that this is done to make the presentation clearer in the terminal. Thanks again

      – Bart
      Mar 11 at 16:26















    84














    The extra space appears when you have file names in your directory needing ' around them (e.g. file names with spaces or other special characters).



    ~/mytmp$ ls
    a 'file(abc)' proyecto3.csv test Test.sh
    b 'file(ab,c?).mp4' rootfile Test1.txt Test.zip
    F26 'file(abc?).mp4' scr Test2.test vowels
    Feb guess script Test2.txt
    'Feb 26 xx' hw something test.rar


    After removing the 'strange' files I get:



    ~/mytmp$ ls
    a guess proyecto3.csv script test Test2.txt Test.sh
    b hw rootfile something Test1.txt test.rar Test.zip
    F26 loop scr speak Test2.test testscript vowels





    share|improve this answer























    • Thank you for the explanation - this sounds correct to me. What threw me is that the extra space at the beginning of the line does not necessarily have to be in front of the file that has the special characters. But I guess that this is done to make the presentation clearer in the terminal. Thanks again

      – Bart
      Mar 11 at 16:26













    84












    84








    84







    The extra space appears when you have file names in your directory needing ' around them (e.g. file names with spaces or other special characters).



    ~/mytmp$ ls
    a 'file(abc)' proyecto3.csv test Test.sh
    b 'file(ab,c?).mp4' rootfile Test1.txt Test.zip
    F26 'file(abc?).mp4' scr Test2.test vowels
    Feb guess script Test2.txt
    'Feb 26 xx' hw something test.rar


    After removing the 'strange' files I get:



    ~/mytmp$ ls
    a guess proyecto3.csv script test Test2.txt Test.sh
    b hw rootfile something Test1.txt test.rar Test.zip
    F26 loop scr speak Test2.test testscript vowels





    share|improve this answer













    The extra space appears when you have file names in your directory needing ' around them (e.g. file names with spaces or other special characters).



    ~/mytmp$ ls
    a 'file(abc)' proyecto3.csv test Test.sh
    b 'file(ab,c?).mp4' rootfile Test1.txt Test.zip
    F26 'file(abc?).mp4' scr Test2.test vowels
    Feb guess script Test2.txt
    'Feb 26 xx' hw something test.rar


    After removing the 'strange' files I get:



    ~/mytmp$ ls
    a guess proyecto3.csv script test Test2.txt Test.sh
    b hw rootfile something Test1.txt test.rar Test.zip
    F26 loop scr speak Test2.test testscript vowels






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 7 at 10:23









    mucluxmuclux

    3,50611131




    3,50611131












    • Thank you for the explanation - this sounds correct to me. What threw me is that the extra space at the beginning of the line does not necessarily have to be in front of the file that has the special characters. But I guess that this is done to make the presentation clearer in the terminal. Thanks again

      – Bart
      Mar 11 at 16:26

















    • Thank you for the explanation - this sounds correct to me. What threw me is that the extra space at the beginning of the line does not necessarily have to be in front of the file that has the special characters. But I guess that this is done to make the presentation clearer in the terminal. Thanks again

      – Bart
      Mar 11 at 16:26
















    Thank you for the explanation - this sounds correct to me. What threw me is that the extra space at the beginning of the line does not necessarily have to be in front of the file that has the special characters. But I guess that this is done to make the presentation clearer in the terminal. Thanks again

    – Bart
    Mar 11 at 16:26





    Thank you for the explanation - this sounds correct to me. What threw me is that the extra space at the beginning of the line does not necessarily have to be in front of the file that has the special characters. But I guess that this is done to make the presentation clearer in the terminal. Thanks again

    – Bart
    Mar 11 at 16:26













    53














    I'm pretty sure file1 file2 file3 is not what's exactly shown on your screen. You omitted precious information (the actual filenames) that might easily be relevant.



    My assumption is that you have a filename that contains a space or other special character.



    Newer version of coreutils's ls quote such filenames, typically in single quotes. Plus, if there's at least one file requiring such quoting, it adds a space in front of all other filenames so that they align up "nicely" if they happen to be underneath each other, that is, the single quote mark (apostrophe) is ignored for alignment.



    See --quoting-style and -N in the manual page of ls for some more details, and the section "Formatting the file names" in its info page for even more details. You might e.g. consider aliasing ls to ls -N.






    share|improve this answer





























      53














      I'm pretty sure file1 file2 file3 is not what's exactly shown on your screen. You omitted precious information (the actual filenames) that might easily be relevant.



      My assumption is that you have a filename that contains a space or other special character.



      Newer version of coreutils's ls quote such filenames, typically in single quotes. Plus, if there's at least one file requiring such quoting, it adds a space in front of all other filenames so that they align up "nicely" if they happen to be underneath each other, that is, the single quote mark (apostrophe) is ignored for alignment.



      See --quoting-style and -N in the manual page of ls for some more details, and the section "Formatting the file names" in its info page for even more details. You might e.g. consider aliasing ls to ls -N.






      share|improve this answer



























        53












        53








        53







        I'm pretty sure file1 file2 file3 is not what's exactly shown on your screen. You omitted precious information (the actual filenames) that might easily be relevant.



        My assumption is that you have a filename that contains a space or other special character.



        Newer version of coreutils's ls quote such filenames, typically in single quotes. Plus, if there's at least one file requiring such quoting, it adds a space in front of all other filenames so that they align up "nicely" if they happen to be underneath each other, that is, the single quote mark (apostrophe) is ignored for alignment.



        See --quoting-style and -N in the manual page of ls for some more details, and the section "Formatting the file names" in its info page for even more details. You might e.g. consider aliasing ls to ls -N.






        share|improve this answer















        I'm pretty sure file1 file2 file3 is not what's exactly shown on your screen. You omitted precious information (the actual filenames) that might easily be relevant.



        My assumption is that you have a filename that contains a space or other special character.



        Newer version of coreutils's ls quote such filenames, typically in single quotes. Plus, if there's at least one file requiring such quoting, it adds a space in front of all other filenames so that they align up "nicely" if they happen to be underneath each other, that is, the single quote mark (apostrophe) is ignored for alignment.



        See --quoting-style and -N in the manual page of ls for some more details, and the section "Formatting the file names" in its info page for even more details. You might e.g. consider aliasing ls to ls -N.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 7 at 12:12

























        answered Mar 7 at 10:23









        egmontegmont

        4,43611126




        4,43611126



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1123706%2fwhy-is-there-an-extra-space-when-i-type-ls-in-the-desktop-directory%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

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

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay