Ln is a very important command. Its function is to create a synchronization link for a file in another location. The most common parameter of this command is-s. Its usage is as follows:
The target file-s of the ln-s source file is symbolic.
Example: ln-s/lib/lsb/usr/lj
That is, create an lj file pointing to the/lib/lsb directory under the usr directory.
When we need to use the same file in different directories, we do not need to put a file that must be the same under each required directory. We only need to put it in a fixed directory, put the file, and then use the ln command link in other directories to link it, without occupying disk space repeatedly. For example, ln-s/bin/less/usr/local/bin/less-s indicates the symbol (symbolic. There are two points to note: first, the ln command will keep the synchronization of each link file, that is, no matter which one you change, other files will change the same; second, there are two types of ln links: Soft link and hard link. The soft link is ln-s *****. It will only generate a file image at your selected location, it does not occupy disk space. The hard link ln *** has no parameter-s. It will generate a file of the same size as the source file at the selected position, both soft links and hard links are synchronized. Soft links can be cross-partition, but hard links can only be within the same partition. If you use ls to view a directory, you will find that some files are followed by a @ symbol, that is, a file generated using ln command, and you can use ls-l command to view it, we can see the link path displayed. When we need to use the same file in different directories, we do not need to put a file that must be the same in every required directory, we only need to put the file in a fixed directory, and then use the ln command link in other directories, without occupying disk space repeatedly. Example: ln-s/bin/less/usr/local/bin/less