Review your favorite Linux distribution.
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 04-02-2010, 02:14 AM   #1
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, 02:32 AM   #2
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, 02:35 AM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
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.

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, 02:58 AM   #4
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, 03:07 AM   #5
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
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, 05:07 AM   #6
LQ Newbie
Registered: Sep 2006
Posts: 3

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


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

All times are GMT -5. The time now is 10:25 PM.

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