LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 11-23-2008, 05:12 PM   #1
newtovanilla
Member
 
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
billymayday
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
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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
lwasserm
Member
 
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
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,201
Blog Entries: 3

Rep: Reputation: 1427Reputation: 1427Reputation: 1427Reputation: 1427Reputation: 1427Reputation: 1427Reputation: 1427Reputation: 1427Reputation: 1427Reputation: 1427
Hi,

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!
 
  


Reply

Tags
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


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