Ln is another very important command in Linux. Its function is to create a non-same link for a file in another location. The most common parameter of this command is-s, the specific usage is the target file of the Ln-S source file.
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
You can use the ln command link in other directories without occupying disk space repeatedly. 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, ln link and
There are two types of soft links and hard links. The soft link is ln-s *****. It will only generate a file image at the position you selected, and will not occupy disk space, hard link ln **
** Without the-S parameter, it will generate a file of the same size as the source file at the position you selected. both soft and hard links keep the file Changing synchronously.
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, the link path is displayed.
Instructions
Command name: ln
Permission: All Users
Usage: ln [Options] source Dist, where the option format is:
[-Bdfinsvf] [-s backup-suffix] [-V {numbered, existing, simple}]
[-- Help] [-- version] [--]
Note: in Linux/UNIX file systems, there is a so-called link. we can regard it as the alias of the file, and the link can be divided into two types: Hard
Link) and soft link (symbolic
Link). A hard Link means that a file can have multiple names, while a soft link generates a special file whose content is directed to another file. Hard links exist in the same file.
In the Case System, soft links can span different file systems.
Ln source dist is used to generate a connection (DIST) to the source. As for hard link or soft link, it is determined by the parameter.
No matter whether it is a hard link or soft link, it will not copy the original file, it will only occupy a very small amount of disk space.
-F: when the link is closed, the file with the same name as dist is deleted first.
-D: allows system administrators to hard link their directories.
-I: When deleting an archive with the same name as Dist, first ask
-N: dist is considered as a normal file During Soft link.
-S: Symbolic Link)
-V: display the file name before the link
-B: Back up the files that will be overwritten or deleted during the link.
-S Suffix: adds the backup file to the end of suffix.
-V method: Specifies the backup method.
-- Help: displays auxiliary instructions
-- Version: displays the version.
Example:
Generate a symbolic link: ZZ
Ln-s YY ZZ
Generate a hard link: ZZ
Ln YY xx
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.