ln -s fail to create a symbolic to directory












0















I tried to create a symbolic link of Books Directory to the Home



#in the Document Directory to the Home Diretory.
ln -s Books/ ~/Books


enter image description here



but it create a file rather than a directory



What's the problem with my usage of ln?










share|improve this question























  • ln -s /home/username/Documents/Books /home/username/Books

    – heynnema
    2 hours ago
















0















I tried to create a symbolic link of Books Directory to the Home



#in the Document Directory to the Home Diretory.
ln -s Books/ ~/Books


enter image description here



but it create a file rather than a directory



What's the problem with my usage of ln?










share|improve this question























  • ln -s /home/username/Documents/Books /home/username/Books

    – heynnema
    2 hours ago














0












0








0








I tried to create a symbolic link of Books Directory to the Home



#in the Document Directory to the Home Diretory.
ln -s Books/ ~/Books


enter image description here



but it create a file rather than a directory



What's the problem with my usage of ln?










share|improve this question














I tried to create a symbolic link of Books Directory to the Home



#in the Document Directory to the Home Diretory.
ln -s Books/ ~/Books


enter image description here



but it create a file rather than a directory



What's the problem with my usage of ln?







symbolic-link






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 hours ago









AliceAlice

417110




417110













  • ln -s /home/username/Documents/Books /home/username/Books

    – heynnema
    2 hours ago



















  • ln -s /home/username/Documents/Books /home/username/Books

    – heynnema
    2 hours ago

















ln -s /home/username/Documents/Books /home/username/Books

– heynnema
2 hours ago





ln -s /home/username/Documents/Books /home/username/Books

– heynnema
2 hours ago










2 Answers
2






active

oldest

votes


















1














This looks like 3rd form according to documentation:




ln [OPTION]... TARGET... DIRECTORY (3rd form)
...
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.




So it reads as "create link to a directory Books (which is in your current working directory) and put that link in specified directory ~/Books". Of course, if Books/ doesn't exist in current working directory - you'll have a symlink pointing to itself, which will result in too many symlink levels error



[ adminx:Fri Feb 22 01:57:21 UTC 2019 ]$ ln -s asdfasdf foobarbaz/
[ adminx:Fri Feb 22 01:57:33 UTC 2019 ]$ ls foobarbaz/
asdfasdf file.txt thing
[ adminx:Fri Feb 22 01:57:37 UTC 2019 ]$ ls -l foobarbaz/
total 0
lrwxrwxrwx 1 adminx adminx 8 Feb 22 01:57 asdfasdf -> asdfasdf
-rw-rw-r-- 1 adminx adminx 0 Feb 22 01:56 file.txt
lrwxrwxrwx 1 adminx adminx 5 Feb 22 01:56 thing -> thing
[ adminx:Fri Feb 22 02:02:29 UTC 2019 ]$ cd foobarbaz/thing
bash: cd: foobarbaz/thing: Too many levels of symbolic links


Now, I would suggest using first form with -T flag:



 adminx:Fri Feb 22 02:05:01 UTC 2019 ]$ ln -s -T  ~/Documents  dock_link
[ adminx:Fri Feb 22 02:05:08 UTC 2019 ]$ ls -l dock_link
lrwxrwxrwx 1 adminx adminx 22 Feb 22 02:05 dock_link -> /home/adminx/Documents
[ adminx:Fri Feb 22 02:05:16 UTC 2019 ]$





share|improve this answer































    1














    It seems like you created a broken link. Books/ is in ~/Documents, so you need to specify that, either with a relative path:



    ln -s Documents/Books ~/Books


    or an absolute path:



    ln -s ~/Documents/Books ~/Books





    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%2f1120262%2fln-s-fail-to-create-a-symbolic-to-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









      1














      This looks like 3rd form according to documentation:




      ln [OPTION]... TARGET... DIRECTORY (3rd form)
      ...
      In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.




      So it reads as "create link to a directory Books (which is in your current working directory) and put that link in specified directory ~/Books". Of course, if Books/ doesn't exist in current working directory - you'll have a symlink pointing to itself, which will result in too many symlink levels error



      [ adminx:Fri Feb 22 01:57:21 UTC 2019 ]$ ln -s asdfasdf foobarbaz/
      [ adminx:Fri Feb 22 01:57:33 UTC 2019 ]$ ls foobarbaz/
      asdfasdf file.txt thing
      [ adminx:Fri Feb 22 01:57:37 UTC 2019 ]$ ls -l foobarbaz/
      total 0
      lrwxrwxrwx 1 adminx adminx 8 Feb 22 01:57 asdfasdf -> asdfasdf
      -rw-rw-r-- 1 adminx adminx 0 Feb 22 01:56 file.txt
      lrwxrwxrwx 1 adminx adminx 5 Feb 22 01:56 thing -> thing
      [ adminx:Fri Feb 22 02:02:29 UTC 2019 ]$ cd foobarbaz/thing
      bash: cd: foobarbaz/thing: Too many levels of symbolic links


      Now, I would suggest using first form with -T flag:



       adminx:Fri Feb 22 02:05:01 UTC 2019 ]$ ln -s -T  ~/Documents  dock_link
      [ adminx:Fri Feb 22 02:05:08 UTC 2019 ]$ ls -l dock_link
      lrwxrwxrwx 1 adminx adminx 22 Feb 22 02:05 dock_link -> /home/adminx/Documents
      [ adminx:Fri Feb 22 02:05:16 UTC 2019 ]$





      share|improve this answer




























        1














        This looks like 3rd form according to documentation:




        ln [OPTION]... TARGET... DIRECTORY (3rd form)
        ...
        In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.




        So it reads as "create link to a directory Books (which is in your current working directory) and put that link in specified directory ~/Books". Of course, if Books/ doesn't exist in current working directory - you'll have a symlink pointing to itself, which will result in too many symlink levels error



        [ adminx:Fri Feb 22 01:57:21 UTC 2019 ]$ ln -s asdfasdf foobarbaz/
        [ adminx:Fri Feb 22 01:57:33 UTC 2019 ]$ ls foobarbaz/
        asdfasdf file.txt thing
        [ adminx:Fri Feb 22 01:57:37 UTC 2019 ]$ ls -l foobarbaz/
        total 0
        lrwxrwxrwx 1 adminx adminx 8 Feb 22 01:57 asdfasdf -> asdfasdf
        -rw-rw-r-- 1 adminx adminx 0 Feb 22 01:56 file.txt
        lrwxrwxrwx 1 adminx adminx 5 Feb 22 01:56 thing -> thing
        [ adminx:Fri Feb 22 02:02:29 UTC 2019 ]$ cd foobarbaz/thing
        bash: cd: foobarbaz/thing: Too many levels of symbolic links


        Now, I would suggest using first form with -T flag:



         adminx:Fri Feb 22 02:05:01 UTC 2019 ]$ ln -s -T  ~/Documents  dock_link
        [ adminx:Fri Feb 22 02:05:08 UTC 2019 ]$ ls -l dock_link
        lrwxrwxrwx 1 adminx adminx 22 Feb 22 02:05 dock_link -> /home/adminx/Documents
        [ adminx:Fri Feb 22 02:05:16 UTC 2019 ]$





        share|improve this answer


























          1












          1








          1







          This looks like 3rd form according to documentation:




          ln [OPTION]... TARGET... DIRECTORY (3rd form)
          ...
          In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.




          So it reads as "create link to a directory Books (which is in your current working directory) and put that link in specified directory ~/Books". Of course, if Books/ doesn't exist in current working directory - you'll have a symlink pointing to itself, which will result in too many symlink levels error



          [ adminx:Fri Feb 22 01:57:21 UTC 2019 ]$ ln -s asdfasdf foobarbaz/
          [ adminx:Fri Feb 22 01:57:33 UTC 2019 ]$ ls foobarbaz/
          asdfasdf file.txt thing
          [ adminx:Fri Feb 22 01:57:37 UTC 2019 ]$ ls -l foobarbaz/
          total 0
          lrwxrwxrwx 1 adminx adminx 8 Feb 22 01:57 asdfasdf -> asdfasdf
          -rw-rw-r-- 1 adminx adminx 0 Feb 22 01:56 file.txt
          lrwxrwxrwx 1 adminx adminx 5 Feb 22 01:56 thing -> thing
          [ adminx:Fri Feb 22 02:02:29 UTC 2019 ]$ cd foobarbaz/thing
          bash: cd: foobarbaz/thing: Too many levels of symbolic links


          Now, I would suggest using first form with -T flag:



           adminx:Fri Feb 22 02:05:01 UTC 2019 ]$ ln -s -T  ~/Documents  dock_link
          [ adminx:Fri Feb 22 02:05:08 UTC 2019 ]$ ls -l dock_link
          lrwxrwxrwx 1 adminx adminx 22 Feb 22 02:05 dock_link -> /home/adminx/Documents
          [ adminx:Fri Feb 22 02:05:16 UTC 2019 ]$





          share|improve this answer













          This looks like 3rd form according to documentation:




          ln [OPTION]... TARGET... DIRECTORY (3rd form)
          ...
          In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.




          So it reads as "create link to a directory Books (which is in your current working directory) and put that link in specified directory ~/Books". Of course, if Books/ doesn't exist in current working directory - you'll have a symlink pointing to itself, which will result in too many symlink levels error



          [ adminx:Fri Feb 22 01:57:21 UTC 2019 ]$ ln -s asdfasdf foobarbaz/
          [ adminx:Fri Feb 22 01:57:33 UTC 2019 ]$ ls foobarbaz/
          asdfasdf file.txt thing
          [ adminx:Fri Feb 22 01:57:37 UTC 2019 ]$ ls -l foobarbaz/
          total 0
          lrwxrwxrwx 1 adminx adminx 8 Feb 22 01:57 asdfasdf -> asdfasdf
          -rw-rw-r-- 1 adminx adminx 0 Feb 22 01:56 file.txt
          lrwxrwxrwx 1 adminx adminx 5 Feb 22 01:56 thing -> thing
          [ adminx:Fri Feb 22 02:02:29 UTC 2019 ]$ cd foobarbaz/thing
          bash: cd: foobarbaz/thing: Too many levels of symbolic links


          Now, I would suggest using first form with -T flag:



           adminx:Fri Feb 22 02:05:01 UTC 2019 ]$ ln -s -T  ~/Documents  dock_link
          [ adminx:Fri Feb 22 02:05:08 UTC 2019 ]$ ls -l dock_link
          lrwxrwxrwx 1 adminx adminx 22 Feb 22 02:05 dock_link -> /home/adminx/Documents
          [ adminx:Fri Feb 22 02:05:16 UTC 2019 ]$






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 51 mins ago









          Sergiy KolodyazhnyySergiy Kolodyazhnyy

          72.8k9152316




          72.8k9152316

























              1














              It seems like you created a broken link. Books/ is in ~/Documents, so you need to specify that, either with a relative path:



              ln -s Documents/Books ~/Books


              or an absolute path:



              ln -s ~/Documents/Books ~/Books





              share|improve this answer




























                1














                It seems like you created a broken link. Books/ is in ~/Documents, so you need to specify that, either with a relative path:



                ln -s Documents/Books ~/Books


                or an absolute path:



                ln -s ~/Documents/Books ~/Books





                share|improve this answer


























                  1












                  1








                  1







                  It seems like you created a broken link. Books/ is in ~/Documents, so you need to specify that, either with a relative path:



                  ln -s Documents/Books ~/Books


                  or an absolute path:



                  ln -s ~/Documents/Books ~/Books





                  share|improve this answer













                  It seems like you created a broken link. Books/ is in ~/Documents, so you need to specify that, either with a relative path:



                  ln -s Documents/Books ~/Books


                  or an absolute path:



                  ln -s ~/Documents/Books ~/Books






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  wjandreawjandrea

                  9,24442563




                  9,24442563






























                      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%2f1120262%2fln-s-fail-to-create-a-symbolic-to-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

                      GameSpot

                      日野市

                      Tu-95轟炸機