0

I am new to Linux, and am trying to understand symbolic links better.

From what I understand, when you create a symbolic link to a file, and you remove the source file manually from the folder without the terminal, the destination still has the file, but you can't open it anymore. Now, if I understood correctly, this is because the source file that the shortcut originates from was deleted, but because it was done manually the shortcut is still in place.

1 Answer 1

0

Does not matter how the original file went away. Doesn't even matter if the "original" file never existed. You can make a symbolic link to any name you like. The only bad thing is to make it to itself, because it thrashes round 50 times before it gets dizzy.

Paul--) ls -l Foo
ls: cannot access 'Foo': No such file or directory
Paul--) ln -s NeverHeardOfIt Foo
Paul--) ls -l Foo
lrwxrwxrwx 1 paul paul 14 Dec 10 17:50 Foo -> NeverHeardOfIt
Paul--) cat Foo
cat: Foo: No such file or directory
Paul--) ls -lL Foo
ls: cannot access 'Foo': No such file or directory

Paul--) ln -s Whirly Whirly
Paul--) ls -l Whirly
lrwxrwxrwx 1 paul paul 6 Dec 10 17:51 Whirly -> Whirly
Paul--) ls -lL Whirly
ls: cannot access 'Whirly': Too many levels of symbolic links
Paul--) cat Whirly
cat: Whirly: Too many levels of symbolic links

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .