Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 28-08-2009, 06:32 AM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Tạo symbolic link và hard link trong Linux
1. Create a symbolic link in UNIX


A symbolic link is a pointer to another file or directory. It can be used just like the original file or directory. A symbolic link appears in a long listing (ls -l) with a reference to the original file/directory. A symbolic link, as opposed to a hard link, is required when linking from one filesystem to another and can be used within a filesystem as well.


To create a symbolic link, the syntax of the command is similar to a copy or move command: existing file first, destination file second. For example, to link the directory /export/space/common/archive to /archive for easy access, use:

ln -s /export/space/common/archive /archive


To link the runtime control script /etc/init.d/httpd to /etc/rc2.d/S77httpd, use:

cd /etc/rc2.d
ln -s ../init.d/httpd S77httpd

Thi du 1:

De tao symbolic lien ket tu thu muc /vz4/private/200 den /vz/private/200

ta danh lenh sau nhu sau:

Trích dẫn:

ln -s /vz4/private/200 /vz/private
chu y:

Chung ta khong can phai tao thu muc ten la: 200 trong thu muc /vz/private


Xoa Symbolic link:

de xoa lien ket symbolic link tren ta chi can go lenh sau:

Trích dẫn:

unlink 200

2.Create a hard link in UNIX

A hard link is a reference to a file or directory that appears just like a file or directory, not a link. Hard links only work within a filesystem. In other words, don’t use hard links between mounted filesystems. A hard link is only a reference to the original file, not a copy of the file. If the original file is deleted, the information will be lost.


To create a hard link of the file /export/home/fred/stuff to /var/tmp/thing, use:

ln /export/home/fred/stuff /var/tmp/thing


The syntax for creating a hard link of a directory is the same.

To create a hard link of /var/www/html to /var/www/webroot, use:

ln /var/www/html /var/www/webroot


Suu tap

AdminPhuong
  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
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 Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 01:38 AM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.