Ln(Link)
Function Description:Connect to a file or directory.
Syntax: ln[-BDfInsv] [-S <tail backup string>] [-V <backup mode>] [-- help] [-- version] [source file or directory] [target file or directory] Or ln [-bdfinsv] [-S <character backup string>] [-V <backup mode>] [-- help] [-- version] [source file or directory...] [destination Directory]
Additional note: lnCommandUsed to connect files or directories. For example, if you specify more than two files or directories at the same time, and the final destination is an existing Directory, all the previously specified files or directories will be copied to this directory. If multiple files or directories are specified at the same time and the destination is not an existing Directory, an error message is displayed.
Parameters:
-B or -- backup is deleted to overwrite the backup before the target file.
-D,-F, or -- directory creates a directory hard connection.
-F or -- force forcibly establish a connection to a file or directory, regardless of whether the file or directory exists.
-I or -- interactive ask the user before overwriting existing files.
-N or -- no-derefereNcE. The target directory of the symbolic connection is considered as a general file.
-S or -- symbolic creates a symbolic connection to the source file instead of a hard connection.
-S <suffix backup string> or --SuFfix = <suffix backup string> after the-B parameter is used to back up the target file, a backup string is added at the end of the backup file. The default suffix backup string is a symbol ~, You can change it through the-S parameter.
-V or -- verbose displays the command execution process.
-V <backup mode> or -- version-conTrOL = <backup mode> after the-B parameter is used to back up the target file, a backup string is added at the end of the backup file. This string can be used not only to change the-S parameter, when you use the-V parameter <backup mode> to specify different backup modes, different backup strings are also generated.
-- Help Online Help.
-- Version: displays the version information.
Ln
This is a very important command in Linux. Please be familiar with it. The function is to create a non-same link for a file in another location.
The most common parameter of a 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 every required directory.
Put the file in a fixed directory, and use the ln command link in other directories. You do not need to repeatedly occupy disk space.
For example, Ln-S/bin/Less/Usr/local/bin/less
-S indicates the symbol (symbolic.
Note the following two points:
First, the ln command will keep the synchronization of each link file. That is to say, other files will change the same no matter which one you have changed;
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, no
Occupy disk space, hard link ln *****, no parameter-S, it will generate a file with the same size as the source file at the position you selected, both soft links and hard links are synchronized.
Third, soft links can be cross-partition, but hard links can only be within the same partition.
If you useLsWhen looking at a directory, I found that some files or folders are in different colors. on my computer, they are blue, which is a file generated by using the ln command, run the ls-l command to view the link path.