Simultaneous references and team ln
-
I can't get into the notion of a symbolic reference. Well, let's say I'm making files.
file1.txt
with contentThis is the first file
and filefile2.txt
with contentthis is the second file
♪Next, I'm taking the team.
ln file1.txt file2.txt
And I'm being challenged by Linux, and he says he couldn't make a hard link. What do I have to add to the first file to make him mention the second? Almost all the examples on the Internetln -s
♪ Why do you need an argument?-s
?I'd be very grateful if anyone could explain the example.
-
I'd like to make my own contribution, because, literally, the day before yesterday, I know what's going on, and I'...
A simple, exhaustive example is the best explanation: as it is said, it's better to feel once more than to watch.
Let's start creating some sort of experimental folder somewhere.
Tests
in the home catalogue:mkdir Tests
Let's go into it.
cd Tests
Now we create a file in it.
source.txt
with text1
:echo 1 > source.txt
Time of reference...
Default (unspecified) team
ln
creates a “hard link”:ln source.txt hard-link.txt
A hard reference is, uh... what the hell? ♪
A hard link is a link file created with the Linux or Unix
ln
command that points to a file's inode♪Source: http://www.computerhope.com/jargon/h/hardlink.htm ♪
Rigid reference - it's a file created by the Linux team (or Unix)
ln
which indicates "inode" reference file.OK.inode” file? ♪
Short for index node, an inode is information contained within a Unix system that contains details about each file, such as the node, owner, file, location of file, etc.
Source: http://www.computerhope.com/jargon/i/inode.htm ♪
Reduction fromindex node" ; inode - This information within the Unix system (inside the operating system), which contains a detailed description of each file; this description includes information on "node” file, information on the owner of the file, some information on the file itself, information on the location of the file, etc.
OK.node” file? ♪
A node or node address is a name or number that identifies a specific computer or terminal in a group of interconnected computers on a network.
Source: http://www.computerhope.com/jargon/n/nodeaddr.htm ♪
Node or node address - is a name or number that identifies a specific computer or terminal in a network-connected computer group.
I mean, this is file identifier in the system...
Uh-oh, sort of a theory that's more or less sorted...
So, we've got a file right now.
Tests
filesource.txt
with text1
and harsh reference to ithard-link.txt
♪Let's experiment...
Changes as
source.txt
andhard-link.txt
synchronized, no wonder.If we transfer any of the files from the current directory within our mounting point, the second file will have no impact and synchronization will work (which means we've moved the file of course). Again, it's not surprising: the file continues to exist as long as there's a single reference to it.
So what's the problem? The implication is that, as mentioned above, the hard reference refers to the file index.inode) So, for example, if we remove any of the files and then create a file at the same location with the same name (and extension), it seems that it should be synchronized with another file, but not here, the link is lost: because the new file is a new index (also when copying the file creates a new file with a new index, and the connection is lost).
Let's go to symbolic references...
On call.
ln
with parameter-s
or--symbolic
A symbolic reference will be made:ln -s source.txt soft-link.txt
Alternatively referred to as a soft link or symlink, a symbolic link is a file that links to another file or directory using its path. Unlike a hard link, a symbolic link can link to any file or directory on any computer. If you are more familiar with Microsoft Windows you can think of a symbolic link as a shortcut in Linux. In Linux and Unix symbolic links are created with the
ln
command. In the Windows command line you can use themklink
command to create symbolic link from the command line.Source: http://www.computerhope.com/jargon/s/symblink.htm ♪
Alternative name soft link (mild/flex) or symlink (Symlin); symbolic reference - it's a file that connects with another file or directory using the latter's track(s). Unlike the hard reference, a symbolic reference may refer to any file or director located on any computer. If you know Microsoft Windows well, you can think of symbolic references as Linux labels. In Linux and Unix symbolic references are created by a team
ln
♪ In the Windows command line, you can use the team.mklink
to create a symbolic reference through a command line.In other words, the symbolic reference refers file addressnot the file index.
Experiment...
If we move the symbolic link.
soft-link.txt
that's not gonna affect the original file.source.txt
, however, in an attempt to open the reference, it will be reported that the link has been breached and that it is proposed to delete the blank reference. And if we move the original file.source.txt
That's the file.soft-link.txt
(this symbolic link) will become empty; however, if we create a new file with the same name as the original file.source.txt
() In the same directory, synchronization will re-establish and work.Somehow...