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;
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
New contributor
add a comment |
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
New contributor
add a comment |
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
New contributor
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
symlink
New contributor
New contributor
edited Apr 14 at 14:08
muru
38k590166
38k590166
New contributor
asked Apr 14 at 13:58
infinityr00tinfinityr00t
12
12
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
.
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
.
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
add a comment |
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
.
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
add a comment |
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
.
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
.
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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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