LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 04-02-2010, 03:14 AM   #1
4X1EG
LQ Newbie
 
Registered: Sep 2006
Posts: 3

Rep: Reputation: 0
What is the difference between a "link" and a "symlink"?


What is the difference between a "link" and a "symlink"? Is it related to hard or soft links?
 
Old 04-02-2010, 03:32 AM   #2
nefg
LQ Newbie
 
Registered: Oct 2007
Posts: 8

Rep: Reputation: 0
If you delete a hardlink you delete the file to which it points also. If you delete a symbolic link, only the link is deleted and the linked file remains.
 
Old 04-02-2010, 03:35 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Symlink is short for symbolic link. AFAIK, the term link includes hard links and symbolic links (symlinks).

When you create a hard link, you are creating a new directory entry. There isn't anything to distinguish the original from the link.

example:
ln lukspart.img lukspart2.img
jschiwal@qosmio:~/Download> ls -l lukspart*.img
-rw-r--r-- 2 jschiwal jschiwal 268435456 2010-04-02 01:11 lukspart2.img
-rw-r--r-- 2 jschiwal jschiwal 268435456 2010-04-02 01:11 lukspart.img

The second column is the link count.
 
Old 04-02-2010, 03:58 AM   #4
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
A symbolic link is a special file that contains a pointer to another file. A hard link is a directory entry. Symbolic links may cross file system boundaries. For instance, a symbolic link may point to a file on a different disk. Multiple hard links may exist for the same file, even in the same directory. But all of the hard links to a file must be contained within the same file system.
 
Old 04-02-2010, 04:07 AM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by nefg View Post
If you delete a hardlink you delete the file to which it points also. If you delete a symbolic link, only the link is deleted and the linked file remains.
Not really. If you delete a hard link, the reference counter to the inode pointed to by that link is decreased by 1. When the reference count reaches zero the space taken up by the file is freed for other use. If you have multiple hard links to the same file, you must delete all of them for the file to go away.
 
Old 04-02-2010, 06:07 AM   #6
4X1EG
LQ Newbie
 
Registered: Sep 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for all the replies for the original question. Much appreciated
 
  


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
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 05:08 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 09:31 AM
Can you explain the difference between "Free Software (GNU)" and "Open Source"? vharishankar General 5 03-03-2005 10:40 AM
difference between "Web server local URL" and "IPv4 address"? kpachopoulos Linux - General 2 09-17-2004 02:30 PM
"User" & "System" CPU load difference JJX Linux - General 3 06-06-2004 02:42 AM


All times are GMT -5. The time now is 08:40 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration