Changing symlink path creates additional folder

Clash Royale CLAN TAG#URR8PPP
up vote
-2
down vote
favorite
I tried to change an existing symlink which is accessable under cd ~/symlink_file_name to another folder with the following command:
ln -sfn /usr/home/myusername/testfolder symlink_file_name
(since the testfolder is also accessable via cd ~/testfolder and shows me with pwd the context: /usr/home/myusername/testfolder).
Running pwd gives me /usr/home/myusername/testfolder.
It works (and I get no additional response or error from ln command), but unfortunately it adds a folder myusername to the testfolder so that the symlink then points to:
/usr/home/myusername/testfolder/myusername
instead to:
/usr/home/myusername/testfolder
which i originally set it to (as you can tell from the ln command at the beginning of my post).
How can I prevent this that it creates the additional folder?
filesystems symlink path
 |Â
show 5 more comments
up vote
-2
down vote
favorite
I tried to change an existing symlink which is accessable under cd ~/symlink_file_name to another folder with the following command:
ln -sfn /usr/home/myusername/testfolder symlink_file_name
(since the testfolder is also accessable via cd ~/testfolder and shows me with pwd the context: /usr/home/myusername/testfolder).
Running pwd gives me /usr/home/myusername/testfolder.
It works (and I get no additional response or error from ln command), but unfortunately it adds a folder myusername to the testfolder so that the symlink then points to:
/usr/home/myusername/testfolder/myusername
instead to:
/usr/home/myusername/testfolder
which i originally set it to (as you can tell from the ln command at the beginning of my post).
How can I prevent this that it creates the additional folder?
filesystems symlink path
1
Please provide a worked example in your question. Start withpwd(and its output) so we have some context. Then theln...command (and any message it may give you - although I wouldn't particularly expect one). Then explain what's not right, what you expected, and how you tried to fix it.
â roaima
Sep 7 at 19:35
@roaima I updated my post a little bit. Sorry but I'm pretty new to linux. Why should I paste thepwdoutput, and for which path?
â Paul
Sep 7 at 19:53
pwdwill give us the directory context in which you're running theln -s. By all means obfuscate BOTH commands similarly if you would like to hide the precise name of one or more of directories. But without the context we can't see where you've putsymlink_file_nameand so we can't reliably determine why you should get the behaviour you're seeing.
â roaima
Sep 7 at 19:55
try to run the commandpwd. inside this path /usr/home/myusername/testfolder what is the results?
â Kasper
Sep 7 at 19:58
1
Sorry, I can't reproduce this at all.
â roaima
Sep 7 at 20:13
 |Â
show 5 more comments
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I tried to change an existing symlink which is accessable under cd ~/symlink_file_name to another folder with the following command:
ln -sfn /usr/home/myusername/testfolder symlink_file_name
(since the testfolder is also accessable via cd ~/testfolder and shows me with pwd the context: /usr/home/myusername/testfolder).
Running pwd gives me /usr/home/myusername/testfolder.
It works (and I get no additional response or error from ln command), but unfortunately it adds a folder myusername to the testfolder so that the symlink then points to:
/usr/home/myusername/testfolder/myusername
instead to:
/usr/home/myusername/testfolder
which i originally set it to (as you can tell from the ln command at the beginning of my post).
How can I prevent this that it creates the additional folder?
filesystems symlink path
I tried to change an existing symlink which is accessable under cd ~/symlink_file_name to another folder with the following command:
ln -sfn /usr/home/myusername/testfolder symlink_file_name
(since the testfolder is also accessable via cd ~/testfolder and shows me with pwd the context: /usr/home/myusername/testfolder).
Running pwd gives me /usr/home/myusername/testfolder.
It works (and I get no additional response or error from ln command), but unfortunately it adds a folder myusername to the testfolder so that the symlink then points to:
/usr/home/myusername/testfolder/myusername
instead to:
/usr/home/myusername/testfolder
which i originally set it to (as you can tell from the ln command at the beginning of my post).
How can I prevent this that it creates the additional folder?
filesystems symlink path
filesystems symlink path
edited Sep 7 at 20:06
roaima
40.6k547110
40.6k547110
asked Sep 7 at 19:08
Paul
62
62
1
Please provide a worked example in your question. Start withpwd(and its output) so we have some context. Then theln...command (and any message it may give you - although I wouldn't particularly expect one). Then explain what's not right, what you expected, and how you tried to fix it.
â roaima
Sep 7 at 19:35
@roaima I updated my post a little bit. Sorry but I'm pretty new to linux. Why should I paste thepwdoutput, and for which path?
â Paul
Sep 7 at 19:53
pwdwill give us the directory context in which you're running theln -s. By all means obfuscate BOTH commands similarly if you would like to hide the precise name of one or more of directories. But without the context we can't see where you've putsymlink_file_nameand so we can't reliably determine why you should get the behaviour you're seeing.
â roaima
Sep 7 at 19:55
try to run the commandpwd. inside this path /usr/home/myusername/testfolder what is the results?
â Kasper
Sep 7 at 19:58
1
Sorry, I can't reproduce this at all.
â roaima
Sep 7 at 20:13
 |Â
show 5 more comments
1
Please provide a worked example in your question. Start withpwd(and its output) so we have some context. Then theln...command (and any message it may give you - although I wouldn't particularly expect one). Then explain what's not right, what you expected, and how you tried to fix it.
â roaima
Sep 7 at 19:35
@roaima I updated my post a little bit. Sorry but I'm pretty new to linux. Why should I paste thepwdoutput, and for which path?
â Paul
Sep 7 at 19:53
pwdwill give us the directory context in which you're running theln -s. By all means obfuscate BOTH commands similarly if you would like to hide the precise name of one or more of directories. But without the context we can't see where you've putsymlink_file_nameand so we can't reliably determine why you should get the behaviour you're seeing.
â roaima
Sep 7 at 19:55
try to run the commandpwd. inside this path /usr/home/myusername/testfolder what is the results?
â Kasper
Sep 7 at 19:58
1
Sorry, I can't reproduce this at all.
â roaima
Sep 7 at 20:13
1
1
Please provide a worked example in your question. Start with
pwd (and its output) so we have some context. Then the ln... command (and any message it may give you - although I wouldn't particularly expect one). Then explain what's not right, what you expected, and how you tried to fix it.â roaima
Sep 7 at 19:35
Please provide a worked example in your question. Start with
pwd (and its output) so we have some context. Then the ln... command (and any message it may give you - although I wouldn't particularly expect one). Then explain what's not right, what you expected, and how you tried to fix it.â roaima
Sep 7 at 19:35
@roaima I updated my post a little bit. Sorry but I'm pretty new to linux. Why should I paste the
pwd output, and for which path?â Paul
Sep 7 at 19:53
@roaima I updated my post a little bit. Sorry but I'm pretty new to linux. Why should I paste the
pwd output, and for which path?â Paul
Sep 7 at 19:53
pwd will give us the directory context in which you're running the ln -s. By all means obfuscate BOTH commands similarly if you would like to hide the precise name of one or more of directories. But without the context we can't see where you've put symlink_file_name and so we can't reliably determine why you should get the behaviour you're seeing.â roaima
Sep 7 at 19:55
pwd will give us the directory context in which you're running the ln -s. By all means obfuscate BOTH commands similarly if you would like to hide the precise name of one or more of directories. But without the context we can't see where you've put symlink_file_name and so we can't reliably determine why you should get the behaviour you're seeing.â roaima
Sep 7 at 19:55
try to run the command
pwd. inside this path /usr/home/myusername/testfolder what is the results?â Kasper
Sep 7 at 19:58
try to run the command
pwd. inside this path /usr/home/myusername/testfolder what is the results?â Kasper
Sep 7 at 19:58
1
1
Sorry, I can't reproduce this at all.
â roaima
Sep 7 at 20:13
Sorry, I can't reproduce this at all.
â roaima
Sep 7 at 20:13
 |Â
show 5 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
To create symbolic link you should do ln -s path to source file name my file name
This will replace source file name with the name of the existing file for which you want to create the symbolic link.
To update symbolic link you should do ln -sfn path to source file name my file name
thx for the quick answer. I already used theln -sfncommand withln -sfn /usr/home/myusername/testfolder testwhich should create a symlink "test" in the current path pointing to "/usr/home/myusername/testfolder". And it does, but (for what ever reason) it also creates a subfolder "myusername" in the directory I point to and points to that folder like so:/usr/home/myusername/testfolder/myusername
â Paul
Sep 7 at 19:44
@Paul. If you do right click on the created file> properties. In the basic tab you should see the link target and location. Not clear in the question whatmyusernamefolder means!?
â Goro
Sep 7 at 19:49
myusernameis the name of my ssh user i connect to the server with. How do I do that via the terminal (since I have only SSH access to the server > no GUI)
â Paul
Sep 7 at 19:54
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
To create symbolic link you should do ln -s path to source file name my file name
This will replace source file name with the name of the existing file for which you want to create the symbolic link.
To update symbolic link you should do ln -sfn path to source file name my file name
thx for the quick answer. I already used theln -sfncommand withln -sfn /usr/home/myusername/testfolder testwhich should create a symlink "test" in the current path pointing to "/usr/home/myusername/testfolder". And it does, but (for what ever reason) it also creates a subfolder "myusername" in the directory I point to and points to that folder like so:/usr/home/myusername/testfolder/myusername
â Paul
Sep 7 at 19:44
@Paul. If you do right click on the created file> properties. In the basic tab you should see the link target and location. Not clear in the question whatmyusernamefolder means!?
â Goro
Sep 7 at 19:49
myusernameis the name of my ssh user i connect to the server with. How do I do that via the terminal (since I have only SSH access to the server > no GUI)
â Paul
Sep 7 at 19:54
add a comment |Â
up vote
0
down vote
To create symbolic link you should do ln -s path to source file name my file name
This will replace source file name with the name of the existing file for which you want to create the symbolic link.
To update symbolic link you should do ln -sfn path to source file name my file name
thx for the quick answer. I already used theln -sfncommand withln -sfn /usr/home/myusername/testfolder testwhich should create a symlink "test" in the current path pointing to "/usr/home/myusername/testfolder". And it does, but (for what ever reason) it also creates a subfolder "myusername" in the directory I point to and points to that folder like so:/usr/home/myusername/testfolder/myusername
â Paul
Sep 7 at 19:44
@Paul. If you do right click on the created file> properties. In the basic tab you should see the link target and location. Not clear in the question whatmyusernamefolder means!?
â Goro
Sep 7 at 19:49
myusernameis the name of my ssh user i connect to the server with. How do I do that via the terminal (since I have only SSH access to the server > no GUI)
â Paul
Sep 7 at 19:54
add a comment |Â
up vote
0
down vote
up vote
0
down vote
To create symbolic link you should do ln -s path to source file name my file name
This will replace source file name with the name of the existing file for which you want to create the symbolic link.
To update symbolic link you should do ln -sfn path to source file name my file name
To create symbolic link you should do ln -s path to source file name my file name
This will replace source file name with the name of the existing file for which you want to create the symbolic link.
To update symbolic link you should do ln -sfn path to source file name my file name
edited Sep 7 at 19:44
answered Sep 7 at 19:40
Goro
5,05552459
5,05552459
thx for the quick answer. I already used theln -sfncommand withln -sfn /usr/home/myusername/testfolder testwhich should create a symlink "test" in the current path pointing to "/usr/home/myusername/testfolder". And it does, but (for what ever reason) it also creates a subfolder "myusername" in the directory I point to and points to that folder like so:/usr/home/myusername/testfolder/myusername
â Paul
Sep 7 at 19:44
@Paul. If you do right click on the created file> properties. In the basic tab you should see the link target and location. Not clear in the question whatmyusernamefolder means!?
â Goro
Sep 7 at 19:49
myusernameis the name of my ssh user i connect to the server with. How do I do that via the terminal (since I have only SSH access to the server > no GUI)
â Paul
Sep 7 at 19:54
add a comment |Â
thx for the quick answer. I already used theln -sfncommand withln -sfn /usr/home/myusername/testfolder testwhich should create a symlink "test" in the current path pointing to "/usr/home/myusername/testfolder". And it does, but (for what ever reason) it also creates a subfolder "myusername" in the directory I point to and points to that folder like so:/usr/home/myusername/testfolder/myusername
â Paul
Sep 7 at 19:44
@Paul. If you do right click on the created file> properties. In the basic tab you should see the link target and location. Not clear in the question whatmyusernamefolder means!?
â Goro
Sep 7 at 19:49
myusernameis the name of my ssh user i connect to the server with. How do I do that via the terminal (since I have only SSH access to the server > no GUI)
â Paul
Sep 7 at 19:54
thx for the quick answer. I already used the
ln -sfn command with ln -sfn /usr/home/myusername/testfolder test which should create a symlink "test" in the current path pointing to "/usr/home/myusername/testfolder". And it does, but (for what ever reason) it also creates a subfolder "myusername" in the directory I point to and points to that folder like so: /usr/home/myusername/testfolder/myusernameâ Paul
Sep 7 at 19:44
thx for the quick answer. I already used the
ln -sfn command with ln -sfn /usr/home/myusername/testfolder test which should create a symlink "test" in the current path pointing to "/usr/home/myusername/testfolder". And it does, but (for what ever reason) it also creates a subfolder "myusername" in the directory I point to and points to that folder like so: /usr/home/myusername/testfolder/myusernameâ Paul
Sep 7 at 19:44
@Paul. If you do right click on the created file> properties. In the basic tab you should see the link target and location. Not clear in the question what
myusername folder means!?â Goro
Sep 7 at 19:49
@Paul. If you do right click on the created file> properties. In the basic tab you should see the link target and location. Not clear in the question what
myusername folder means!?â Goro
Sep 7 at 19:49
myusername is the name of my ssh user i connect to the server with. How do I do that via the terminal (since I have only SSH access to the server > no GUI)â Paul
Sep 7 at 19:54
myusername is the name of my ssh user i connect to the server with. How do I do that via the terminal (since I have only SSH access to the server > no GUI)â Paul
Sep 7 at 19:54
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f467611%2fchanging-symlink-path-creates-additional-folder%23new-answer', 'question_page');
);
Post as a guest
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
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
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
1
Please provide a worked example in your question. Start with
pwd(and its output) so we have some context. Then theln...command (and any message it may give you - although I wouldn't particularly expect one). Then explain what's not right, what you expected, and how you tried to fix it.â roaima
Sep 7 at 19:35
@roaima I updated my post a little bit. Sorry but I'm pretty new to linux. Why should I paste the
pwdoutput, and for which path?â Paul
Sep 7 at 19:53
pwdwill give us the directory context in which you're running theln -s. By all means obfuscate BOTH commands similarly if you would like to hide the precise name of one or more of directories. But without the context we can't see where you've putsymlink_file_nameand so we can't reliably determine why you should get the behaviour you're seeing.â roaima
Sep 7 at 19:55
try to run the command
pwd. inside this path /usr/home/myusername/testfolder what is the results?â Kasper
Sep 7 at 19:58
1
Sorry, I can't reproduce this at all.
â roaima
Sep 7 at 20:13