the linux ln (link) command in the usual manner

ln (i.e., link) a link establishing function is synchronized in another location for a certain file.

There are two links, one is hard links (hard link), and the other is a symbolic link (symbolic link), also known as soft links.

Hard links and the original files are stored in two different names for the same physical address, so hard link is mutual;

Symbol content just a number of links to the file name linked files, when using ls -l, symbolic link to the first "l" of the first term .    

When in a different directory, use the same file may not be necessary in each directory are required to put a file must be the same, as long as a fixed directory, put the file, and then in the other directory ln command with a link (link) it can, without having to repeat the occupied disk space.

For example: LN -s  /lib64/libc-2.14.so /lib64/libc.so.6  

This command is most commonly used parameters are -s, it is the code (symbolic) meaning.

Ls -l command used to look, can see the display link path


There are three points to note:

First, ln command will keep every link file synchronization, that is, no matter what you change a place, other files are the same change;

Second, ln links and soft links and hard links are two kinds of soft links is ln -s src dst, it will only generate a mirror file in your selected position, it does not take up disk space, hard links ln src dst, no argument -s, it will generate the same source file and a file size of your selected position, whether it is soft or hard links links, files are synchronized change. 

Third, pointing to a file of all the hard links are deleted, then delete the contents of the file will be deleted as long as the source soft link link files, soft link also fails


Create a soft link

ln -s [source file or directory] [destination file or directory]

For example: the current path leads /lib64/libc-2.14.so folder created libc.so.6 

ln –s  /lib64/libc-2.14.so  libc.so.6

Delete soft links

For example : Delete libc.so.6  RM -rf libc.so.6

Modify soft links

This will modify the existing link address to the new address

L n--snf [new source file or directory] [target file or directory]

E.g:

Create a soft link

ln -snf libc-2.14.so  libc.so.6

Modify the new path pointing

ln -snf libc-2.14.so libc.so.6.bak



- there is a division ------------------------ ---------------- line of thinking --- -----

Ln -help you can see more.

Commonly used parameters:

-b delete, covering previously established links

-d allows users to create a super directory hard links

-f enforcement

-i interactive mode, the user is prompted whether the file exists cover

-n generally regarded as the symbolic link directory

-s soft links (symlinks)

-v display detailed processing procedure


Guess you like

Origin blog.51cto.com/14074978/2416657