LN is a very important command in Linux. Its function is to set up a synchronized link for a file in another location, the most common parameter of this command is-s, the use is:
Ln-s source file Target file-S is the meaning of symbolic.
Example: Ln-s/LIB/LSB/USR/LJ
That is, create a LJ file in the USR directory that points to the/LIB/LSB directory.
When we need to use the same file in different directories, we do not need to put a file in each required directory, we just put the file in a fixed directory, and then in the other directory with the ln command link it can, do not have to repeatedly occupy disk space. For example: Ln-s/bin/less/usr/local/bin/less-s is the code name (symbolic) meaning. Here are two points to note: first, the LN command will maintain the synchronization of each linked file, that is, no matter where you change, the other files will change the same; second, ln links and soft links and hard links two, soft link is ln-s * *, It will only generate a mirror image of the file in the location you selected, not disk space, hard link ln * *, no parameter-s, it will generate a file in your chosen location with the same size as the source file, whether it is a soft link or a hard link, the file will remain in sync. Soft links can span partitions, but hard links are only within the same partition. If you use LS to look at a directory, found that there is a file behind the @ symbol, that is, a file generated with the LN command, with the ls-l command to see the path of the link will be shown when we need to use the same file in different directories, We do not need to put in every required directory must be the same file, we just put the file in a fixed directory, and then in other directories with the ln command link (link) it can, do not have to repeatedly occupy disk space. Example: Ln-s/bin/less/usr/local/bin/less
Attention:
First, the LN command maintains the synchronization of each linked file, meaning that no matter where you change it, the other files will change the same.
Second, ln links and soft links and hard links two, soft link is ln-s * * *, it will only be in the location you selected to generate a file image, does not occupy disk space, hard link LN * * *, no parameter-s, it will be in the location you selected to generate a file with the same size as the source file, Files are kept in sync, whether they are soft links or hard links. Soft links can span partitions, but hard links are only within the same partition.
Third: The directory cannot establish a hard link, but can establish a soft link.
The in command in Linux