Why doesn't my symbolic link work?
        Posted  
        
            by 
                orokusaki
            
        on Super User
        
        See other posts from Super User
        
            or by orokusaki
        
        
        
        Published on 2012-11-28T15:47:35Z
        Indexed on 
            2012/11/28
            17:07 UTC
        
        
        Read the original article
        Hit count: 539
        
I'm trying to better understand symbolic links... and not having very much luck. This is my actual shell output with username/host changed:
username@host:~$ mkdir actual
username@host:~$ mkdir proper
username@host:~$ touch actual/file-1.txt
username@host:~$ echo "file 1" > actual/file-1.txt
username@host:~$ touch actual/file-2.txt
username@host:~$ echo "file 2" > actual/file-2.txt
username@host:~$ ln -s actual/file-1.txt actual/file-2.txt proper
username@host:~$ # Now, try to use the files through their links
username@host:~$ cat proper/file-1.txt
cat: proper/file-1.txt: No such file or directory
username@host:~$ cat proper/file-2.txt
cat: proper/file-2.txt: No such file or directory
username@host:~$ # Check that actual files do in fact exist
username@host:~$ cat actual/file-1.txt
file 1
username@host:~$ cat actual/file-2.txt
file 2
username@host:~$ # Remove the links and go home :(
username@host:~$ rm proper/file-1.txt
username@host:~$ rm proper/file-2.txt
I thought that a symbolic link was supposed to operate transparently, in the sense that you could operate on the file that it points to as if you were accessing the file directly (except of course in the case of rm where of course the link is simply removed).
© Super User or respective owner