Symbolic Link Restores Original File Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionHow to get full path of original file of a soft symbolic link?Unable to stat symbolic link to fileSymbolic Link with Existing DirectoryFinding the original file of a symbolic linkSystem wide symbolic linksymbolic link new targetPurpose of $ in Symbolic Link?Changing file permissions given its symbolic linkRemove symbolic linkStat Symbolic Link : won't show original file modification time

How to react to hostile behavior from a senior developer?

Why weren't discrete x86 CPUs ever used in game hardware?

Question about debouncing - delay of state change

Is there any word for a place full of confusion?

Disembodied hand growing fangs

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?

Why is Nikon 1.4g better when Nikon 1.8g is sharper?

Why do we need to use the builder design pattern when we can do the same thing with setters?

Why do we bend a book to keep it straight?

Find 108 by using 3,4,6

What is the topology associated with the algebras for the ultrafilter monad?

How fail-safe is nr as stop bytes?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

Do I really need to have a message in a novel to appeal to readers?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

How to write the following sign?

Should I use a zero-interest credit card for a large one-time purchase?

Is CEO the "profession" with the most psychopaths?

How does light 'choose' between wave and particle behaviour?

Drawing without replacement: why is the order of draw irrelevant?

Trademark violation for app?

How does the math work when buying airline miles?



Symbolic Link Restores Original File



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow to get full path of original file of a soft symbolic link?Unable to stat symbolic link to fileSymbolic Link with Existing DirectoryFinding the original file of a symbolic linkSystem wide symbolic linksymbolic link new targetPurpose of $ in Symbolic Link?Changing file permissions given its symbolic linkRemove symbolic linkStat Symbolic Link : won't show original file modification time



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








0















On Linux, I created a file (file1):



echo Hello file1 > file1


Then, I created a symbolic link (file2), to file1:



ln -s file1 file2


After that, I removed file1:



rm file1


Lastly, I edited file2 to be different:



echo Changed file2 > file2


After all of these steps were executed, I observed that file1 and file2 now contain "Changed file2".



From what I understand, after file1 is removed, the symbolic link (file2) no longer works. However, the interesting part which I hope to get an answer to, is that editing file2 causes file1 to be restored (despite file1 being removed earlier on).



Thank you very much for your time.










share|improve this question









New contributor




infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    0















    On Linux, I created a file (file1):



    echo Hello file1 > file1


    Then, I created a symbolic link (file2), to file1:



    ln -s file1 file2


    After that, I removed file1:



    rm file1


    Lastly, I edited file2 to be different:



    echo Changed file2 > file2


    After all of these steps were executed, I observed that file1 and file2 now contain "Changed file2".



    From what I understand, after file1 is removed, the symbolic link (file2) no longer works. However, the interesting part which I hope to get an answer to, is that editing file2 causes file1 to be restored (despite file1 being removed earlier on).



    Thank you very much for your time.










    share|improve this question









    New contributor




    infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      On Linux, I created a file (file1):



      echo Hello file1 > file1


      Then, I created a symbolic link (file2), to file1:



      ln -s file1 file2


      After that, I removed file1:



      rm file1


      Lastly, I edited file2 to be different:



      echo Changed file2 > file2


      After all of these steps were executed, I observed that file1 and file2 now contain "Changed file2".



      From what I understand, after file1 is removed, the symbolic link (file2) no longer works. However, the interesting part which I hope to get an answer to, is that editing file2 causes file1 to be restored (despite file1 being removed earlier on).



      Thank you very much for your time.










      share|improve this question









      New contributor




      infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      On Linux, I created a file (file1):



      echo Hello file1 > file1


      Then, I created a symbolic link (file2), to file1:



      ln -s file1 file2


      After that, I removed file1:



      rm file1


      Lastly, I edited file2 to be different:



      echo Changed file2 > file2


      After all of these steps were executed, I observed that file1 and file2 now contain "Changed file2".



      From what I understand, after file1 is removed, the symbolic link (file2) no longer works. However, the interesting part which I hope to get an answer to, is that editing file2 causes file1 to be restored (despite file1 being removed earlier on).



      Thank you very much for your time.







      symlink






      share|improve this question









      New contributor




      infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Apr 14 at 14:08









      muru

      38k590166




      38k590166






      New contributor




      infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Apr 14 at 13:58









      infinityr00tinfinityr00t

      12




      12




      New contributor




      infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      infinityr00t is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          3














          The first file, file1, was not actually restored by your process. It was instead created when you ran echo Changed file2 > file2. file2 was a link to a then-non-existent file file1; a symlink does not have to point to an existing file. Because it was a symlink, the system resolved it and redirected the output of the echo command to file1, creating that file, and leaving the file2 symlink in place pointing to file1.






          share|improve this answer























          • Lovely, appreciate the quick response. I should have been more careful with my words about it being created instead of being restored. Thank you!

            – infinityr00t
            Apr 14 at 14:12











          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          );



          );






          infinityr00t is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512414%2fsymbolic-link-restores-original-file%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









          3














          The first file, file1, was not actually restored by your process. It was instead created when you ran echo Changed file2 > file2. file2 was a link to a then-non-existent file file1; a symlink does not have to point to an existing file. Because it was a symlink, the system resolved it and redirected the output of the echo command to file1, creating that file, and leaving the file2 symlink in place pointing to file1.






          share|improve this answer























          • Lovely, appreciate the quick response. I should have been more careful with my words about it being created instead of being restored. Thank you!

            – infinityr00t
            Apr 14 at 14:12















          3














          The first file, file1, was not actually restored by your process. It was instead created when you ran echo Changed file2 > file2. file2 was a link to a then-non-existent file file1; a symlink does not have to point to an existing file. Because it was a symlink, the system resolved it and redirected the output of the echo command to file1, creating that file, and leaving the file2 symlink in place pointing to file1.






          share|improve this answer























          • Lovely, appreciate the quick response. I should have been more careful with my words about it being created instead of being restored. Thank you!

            – infinityr00t
            Apr 14 at 14:12













          3












          3








          3







          The first file, file1, was not actually restored by your process. It was instead created when you ran echo Changed file2 > file2. file2 was a link to a then-non-existent file file1; a symlink does not have to point to an existing file. Because it was a symlink, the system resolved it and redirected the output of the echo command to file1, creating that file, and leaving the file2 symlink in place pointing to file1.






          share|improve this answer













          The first file, file1, was not actually restored by your process. It was instead created when you ran echo Changed file2 > file2. file2 was a link to a then-non-existent file file1; a symlink does not have to point to an existing file. Because it was a symlink, the system resolved it and redirected the output of the echo command to file1, creating that file, and leaving the file2 symlink in place pointing to file1.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 14 at 14:03









          JohnJohn

          11.9k11931




          11.9k11931












          • Lovely, appreciate the quick response. I should have been more careful with my words about it being created instead of being restored. Thank you!

            – infinityr00t
            Apr 14 at 14:12

















          • Lovely, appreciate the quick response. I should have been more careful with my words about it being created instead of being restored. Thank you!

            – infinityr00t
            Apr 14 at 14:12
















          Lovely, appreciate the quick response. I should have been more careful with my words about it being created instead of being restored. Thank you!

          – infinityr00t
          Apr 14 at 14:12





          Lovely, appreciate the quick response. I should have been more careful with my words about it being created instead of being restored. Thank you!

          – infinityr00t
          Apr 14 at 14:12










          infinityr00t is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          infinityr00t is a new contributor. Be nice, and check out our Code of Conduct.












          infinityr00t is a new contributor. Be nice, and check out our Code of Conduct.











          infinityr00t is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • 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%2funix.stackexchange.com%2fquestions%2f512414%2fsymbolic-link-restores-original-file%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

          getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

          Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

          Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.