Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng

Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng (http://quantrinet.com/forum/index.php)
-   Linux và các thủ thực nhỏ (http://quantrinet.com/forum/forumdisplay.php?f=430)
-   -   Tạo symbolic link và hard link trong Linux (http://quantrinet.com/forum/showthread.php?t=3375)

hoctinhoc 28-08-2009 06:32 AM

Tạo symbolic link và hard link trong Linux
 
1. Create a symbolic link in UNIX

http://m1.2mdn.net/viewad/817-grey.gif
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
:battay:


Bây giờ là 04:24 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.