Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-22-2008, 12:34 PM   #1
Registered: Oct 2006
Location: The Ether
Distribution: Lubuntu 14.04 LTS, Kali
Posts: 297

Rep: Reputation: 30
Symbolic link does not work ( or is it me ) ?

Hi there.
I created a small text file and saved it as data.txt. I then proceeded to make a symbolic link to this file :

$ ln -s data.txt data.sym
I done a "cat" on data.sym and I got a listing of the contents of the original data.txt file. I moved the symbolic link to a different directory, cd to that directory and when I cat the symbolic link I get
cat: data.sym: No such file or directory
I was expecting the contents of the data.txt file to be shown.

I also done this :

$ ln -s data.txt ~/temp/data.sym
I moved to the temp directory and same thing again, I done cat on data.sym and got the "No such file or directory" error. Is this expected behaviour ? If so why ? The original file and symlink don't have to reside in the same directory do they ?

Old 10-22-2008, 01:40 PM   #2
Registered: May 2008
Distribution: Gentoo
Posts: 306

Rep: Reputation: 34
I'm not sure why the second one is having problems, but the problems with the first could be because you moved the symlink. It is looking for the file in the current directory, as you created it in the same directory as the file it references. When you moved it it's now looking for the original file in the directory you moved the symlink to.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
symbolic link not allowed or link target not accessible paullaubscher Linux - Newbie 4 03-10-2010 06:47 AM
Symbolic Link metallica1973 Linux - Networking 4 08-31-2008 11:13 PM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 07:40 AM
Symbolic link does not work via SAMBA ibex Linux - Networking 1 09-29-2006 04:05 PM
symbolic link can't work under ftp Joe_Zhu Linux - Networking 2 06-07-2006 02:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration