link/symbolic link~ What is the difference?

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
このメッセージを削除
このメッセージに返信
著者: William Lindley
日付:  
古いトピック: link/symbolic link~ What is the differance?
新しいトピック: Renamed document file becomes a zip archive., Compiling kernel
題目: link/symbolic link~ What is the difference?
Both types of link are quite unlike a copy.

    cp existing_file new_name


      creates a copy of existing_file called new_name.  The
      new file will have a unique inode, so changing the new
      file won't affect the old one, and vice versa.  NOTE: unlike
      DOS, unix "cp" by default stamps the new file with the current
      date and time; use "cp -p" to preserve the date and time.


    ln target_file new_name


      creates a directory entry called new_name which has the
      same inode (physical disk location) as the target_file.
      The target_file must be an existing file on the disk.
      Editing the file by either name changes them both.
      If you then delete (rm) one of them, the file contents
      stay on the disk... until you delete *all* of the inodes
      that point to it.


    ln -s target_file new_name


      creates a directory entry called new_name which is a
      reference (i.e., redirection) to the target_file.  The
      target_file need not even exist.  So "ln -s bar foo"
      just means that anytime you refer to "foo" it is the same
      as referring to "bar" ... if you delete the real file "bar"
      then "cat foo" will say "No such file or directory" even
      though the link "foo" exists (because "bar" doesn't).


\\/
http://www.wlindley.com