Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-10-2004, 06:03 AM   #1
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!
Old 05-10-2004, 07:05 AM   #2
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

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


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 12:53 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