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 11-23-2008, 05:12 PM   #1
Registered: Apr 2008
Posts: 267

Rep: Reputation: 30
Question 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?
Old 11-23-2008, 05:14 PM   #2
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Use rm like you would for a normal file.

Try googling for the difference between soft and hard.
1 members found this post helpful.
Old 11-23-2008, 06:16 PM   #3
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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.
1 members found this post helpful.
Old 11-23-2008, 08:49 PM   #4
Registered: Mar 2008
Location: Baltimore Md
Distribution: ubuntu
Posts: 184

Rep: Reputation: 41
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.
Old 11-23-2008, 11:13 PM   #5
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,867
Blog Entries: 27

Rep: Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162Reputation: 2162

You should look at the 'Rute Tutorial & Exposition' a good admin guide fro GNU/Linux.

Checkout the 'Linux General Help' section of 'Slackware-Links' for other good links. More than just SlackwareŽ links!


link, ln

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
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 07:40 AM
Can I delete a symbolic link and the file its linked to? mavness Linux - General 4 02-14-2007 01:31 PM
How to delete a symbolic link aroop Linux - Newbie 24 07-29-2004 01:52 AM
Can't delete symbolic link chichibabin Linux - General 1 01-20-2004 06:30 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:13 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