[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to create a link of another directory in home directory ...2



faisal gillani <fasi_74@yahoo.com> writes:
>  what is the diffrence between a symbolic & a hard link ? 

A symbolic link is a directory entry that points to the name of
another file.  For example:

dmaze% echo hello > foo
dmaze% ln -s foo bar
dmaze% ls -l bar
lrwxrwxrwx    1 dmaze    dmaze           3 Apr 27 23:55 bar -> foo
dmaze% cat bar
hello
dmaze% echo goodbye > foo
dmaze% cat bar
goodbye

On the other hand, a hard link means giving two names to the same
file.  This means you can do things like this:

dmaze% echo hello > foo
dmaze% ln foo bar
dmaze% ls -i foo bar
  32412 bar    32412 foo
dmaze% rm foo
dmaze% cat bar
hello
dmaze% echo goodbye > foo
dmaze% cat bar
hello

(With a symbolic link, the fourth and fifth commands would produce an
error; bar would be a 'dangling' symlink, pointing to a nonexistent
file named foo.)

In general, symbolic links are used over hard links, since it is much
easier to tell what is intended to be a link and what isn't.  It also
means that, if you want to replace the file that the links point to,
you can just do that without worrying about rebinding the links to the
new file.  It is also the case that, except under certain restricted
conditions, you cannot create hard links to directories; you must use
symbolic links.

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: