How do you delete a link? How to tell if it is symbolic?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do you delete a link? How to tell if it is symbolic?
This is probably an easy question, but I could not find the answer in the man pages. I found some output from the "ls -l" command to have an "l" in front of it, and I found out that stands for a "link", and then I found the "ln" command for creating a link. When I read the man page for ln, by using the command "man ln", I could not find a way to delete the link. How do I delete the link?
Second question, is what is the difference between a "hard" link and a "symbolic" link? Does it matter if I delete a hard link? What about a symbolic link? Are files linked? What about directories? executables?
Pick a file you don't care about and make both kinds of links. Then delete the original file and then try to open each link. This will tell most of the story.
A hard link is another reference (pointer) to a file. Once created, the link and the original are indistinguishable....except: If you make a soft link to the original, and a hard link, then delete the original, the hard link still finds the file---the soft link does not.
The "file" command will give you basic information about a file including whether it is a symbolic link or not, for example:
~$ file /etc/rc2.d/S30gdm
/etc/rc2.d/S30gdm: symbolic link to `../init.d/gdm'
To add to what pixellany said, a hard link is an actual directory entry that points to a file stored on disk. hard links can only point to files on the same filesystem. A symlink, on the other hand, points to an existing directory entry rather than an actual file. So if the file is deleted or renamed, the symlink becomes a broken link. A symlink can reference a file on another filesystem or partition.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.