|
1. Use way: ln [option] source_file dist_file
When -f is established, it will be deleted with the file name.
For questioning before -i deleted.
ln -s abc cde establish abc soft links
ln abc cde abc hard to establish the connection,
2. The difference between soft and hard links link (popular):
Hard links can be thought of as a file has two file names; and soft link is a link to a new system file that points to the file it refers to
ln -s / root / lntest / source / / root / lntest / dist /
Here is a link to see the soft Shortcuts
3. The difference between soft links and hard links (explain):
Linux soft and hard-wired connection
For a file, there is a unique index corresponding contacts, while the index for a number of contacts, but can have multiple file names corresponding thereto. Thus, in the same file on the disk you can go to access the file through a different path. Note that in Linux is ah, folders, plus a new hard drive file ... Everything can be watched file to handle ah.
Connected with a soft and hard-wired connection (hard link) points, the flexible connection (symbolic link) called symbolic links. Symbolic link is a shortcut to Windows.
Not hard to establish a folder connection, we usually use more or soft connection.
eg:
ln -s source dist # establish a flexible connection
ln -s / mnt / hgfs / / home / luo / note "/" is the file links all over the back of the catalog must be added, otherwise the build directory show unusual colors, you still can not access, such as cd into do not
ln source dist # establish a hard link
Soft link is really just a piece of text, which contains the name of the file it points to the location of the file system automatically jump to see the soft link after corresponding processing; on the contrary, hard to open a new connection for the file directory entry, hard links to the original file name is affirmative, and in Linux it seems that they are equivalent. For this reason, hard links can not be connected to two different files on the file system.
(1) soft links can span file systems, not hard-wired. Practice method is to use a shared file to aa.txt text document attached to the lower windows under linux / root directory under bb, cc. Ln -s aa.txt / root / bb successful connection. ln aa.txt / root / bb fail.
(2) I node on the issue. Hard-wired no matter how many are pointing to the same I node, the node will increase the number of connections, as long as the connection node is not 0, the file has existed, whether you delete the source files are still connected. As long as there exists a file exists (in fact, do not distinguish what source connection file, because they are all pointing to the same node I). When you modify the source document or connection file any one time, other documents will be made to synchronize changes. Soft links do not directly use the i-node number as a file pointer, but the use of the file path name as a pointer. So delete the connection file has no effect on the source file, but delete the source file, the file will not find the connection to point to a file. Soft link has its own inode, and a small piece of space on disk storage path name.
(3) soft links to the file name can be a non-existent connection.
(4) soft connection can connect to the directory.
Note: I node: it is used to describe the internal data structures UNIX file characteristics we usually say I node as a file index nodes (node information) .i node containing the most important information about the file, including file data blocks. address on the disk. each node has its own I flag number, we call information 1. file sequence number .I node contains file owner relationship type 2. 3. 4. time file access file cut. |
|
|
|