LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 05-10-2004, 06:03 AM   #1
Greg_courageous
LQ Newbie
 
Registered: Apr 2004
Posts: 13

Rep: Reputation: 0
Symbolic Links


Hey everyone, i have a question that has been bugging me, someone might be able to help...

I know how the commands rm and ls work on ordinary files. but i want to know how the work on symbolic links.
Does a symbolic link point to an existing file???
What happens if the actual file of a symbolic link is deleted? Is it possible for a symbolic link to point to another symbolic link?

if anyone knows much about them any help would be greatly appreciated!
Thanks!
Greg
 
Old 05-10-2004, 07:05 AM   #2
robkg
LQ Newbie
 
Registered: May 2004
Posts: 18

Rep: Reputation: 0
ls can also list symbolic links;

tosca~$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 36 Apr 10 19:44 /etc/localtime -> /usr/share/zoneinfo/Europe/Amsterdam
tosca~$

rm by default does only remove the symlink, not the file that it is pointing to. However when you read or write to a symbol link, it will write the contents to the file that the symlink points to.
When you remove the target file which the symlink is pointing to, the symlink does not disappear, because the target file does not keep information about which symlinks point to it. You can just remove a symlink that points to a non-existing file.
If you try to read from it, it just says the file does not exist.
symlinks can point to other links, but i believe that there is a limit to the ammount of links they point to.
Try this:

$ ln -s a b
$ ln -s b a
$ cat a
cat: a: Too many levels of symbolic links
$

Hope it was helpful
 
  


Reply


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 Links petercool Linux - General 2 08-20-2003 11:15 AM
Symbolic links bkmesenbrink Linux - Newbie 2 11-13-2002 11:54 AM
Symbolic links pdstatha Programming 1 04-08-2002 09:50 PM
symbolic links winger Linux - General 5 04-06-2002 05:16 PM
Symbolic links Valerie Linux - Newbie 12 03-31-2002 01:49 AM


All times are GMT -5. The time now is 03:11 AM.

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