We have just talked about the difference between hard and soft links.
But the way they actually needed Linux, if you want to create a copy of specific file, you could,
of course, use S.P. comment and copy one file to another user file and use them separately.
But if you want to reuse specific file.
And the only change is location.
You could simply use link to existing file.
Same with directories.
There was no need to copy entire directory.
You could simply create a link to that directory.
And that's it.
For example, if I go here one level up, seedy and seedy, actually, dude folder and list files and
folders here, I'll see that such folders as.
As being Liebe and LEEP thought.
The two are simply links to Özer directories like user SBM.
I could verify that the user has been is directory by using a simply Alaska amount and ILEC actually
contents of that folder.
And that means that you are able to create links, eyes or for files or for directories.
And now let's do some experiments and let's create the links ourselves.
Let's see the home directory.
And let's at least files and folders here.
And here I see some files and folders that I have created before.
If you see here, empty folder, please create any new text file.
I'll create no link to file a file.
But the extent that is already present here in this folder for that I will use comment l m and first,
as the first argument here will be.
Name of existing file.
In this case, File five takes time and the space will be made of the link.
And let's suppose that I'll create a link with name file five that link dot dig.
And actually I'll create first soft link.
Let me add here.
Soft link like salt and I'll add additional option here.
This s to indicate that I want to create soft link.
Let's press enter and let's list files and folders now.
And I see no file file file.
Softly Dodik.
And if I have a look at contours of this file.
Like, so I alsi actually contours of a file.
Five to dig text.
All right.
Let's not list filed using L option unless this L.
And no, I see that file file desk solved.
Linda digs deep, is looking to file a five to six deal.
And he, of course, you'll see a difference in permissions, difference in size and difference in data
modification and does because I have just created solely to link to a file of five boutiques deep.
All right, let's note the following.
Let's read one more copy of a five takes D using S.P..
Come and grab him and let's copy a file.
Fire that the extreme do file seeks to dig deep.
Like so.
Let's list files and folders now.
And there was additional file.
Six Dodig Steve sighs is the same as size of file, five to 60.
Here it is.
But those files are completed.
Two different files.
And if you change file five or the deep, there will be no change in file.
Six takes deep.
But there will be change in this link.
Let's try that.
Let's modify file five DODIG Steve.
And for that, let's use nano ed.
Nano File.
Five Dodig Steve.
And let's modify first line.
And here I'll type file was just modified like.
So let's say it changes control.
Yes.
And press enter and no less with contents of file five to dig deep.
Got file five.
Actually I could use a head head file file to the extreme.
Sorry Dipo.
The extreme actually let me use a dash.
An option and with only thrust like that and one like so and ILC file was just modified.
Let's now read contents of link to this file.
Had this in one file five this soft link to dig deep and I'll see the same contents.
And this because this file is simply link to this file.
Let's no read the contents of file 636, do you.
Let's again we'd only frost line and I see the first line in this file remained unchanged.
This because file six is gloppy of file file.
The text still not its link.
All right.
Let's again, at least files and folders here.
And let's not delete a file.
Five batiks deep.
R.
M file.
Five days steam and less list files and folders again.
And now I see that there is still this link here in this list.
But if I tried to read it, got to file five.
Best of to take Steve.
I'll see error.
No such file or directory.
And doesn't because file five destination file for this link was actually removed.
All right.
Let's not simply remove this soft link.
Our M file five soft link, and this file is not absolute.
All right, let's not green card link for file six, but the extreme for that, we will use the same
comment.
L.
N.
But now, without any options.
L m here will be a file name.
Name of the original file.
File six.
Dot the extreme.
And here will the name of the hard link.
Let's say file six.
This hard link dot the extreme anthem.
Let's list files and folders now.
And now I see newly created file file six.
This card Linda takes Steve.
And those files have same permissions, same size and same modification date.
List, no, try to modify file six to dig steam nano file seeks to dig steam.
And here, let's again add some changes here on the frost line.
And Link was just modified.
Like, so let's say it changes.
Yes.
And now let's have a look at the contents of this folder.
And I see that file.
Seek's was modified, but a file six hard link was modified as well.
You'll see the same modification time.
And if I read contents of file things, the text now and contents of file six hard Linda to external,
they will be exactly the same.
Let's do it.
Let's use again.
Had this.
And one file six under the extreme.
I see this first line in this file similar to X2 and Liz did the same with the huddling file six Sandesh
huddling and I see same line.
And that means that now those files both reflect same change.
And the reason for that is that they point to the same I note in memory.
Let's go back to Alexander's Elle comment and add additional option.
I that will show us.
I know.
No.
And this I know number is the same for those most files.
And finally, let's try to remove one of those files and see Wells or another file will remain in place
or not.
And let's remove a file since the dig still.
Our M file seeks to dig steam.
Unless and I don't see five or six to this day here in this list.
But I still see file six.
How Linda digs do.
Here it is.
And now let's again with contents of this file, had the dish and one file, six hard link, and we
see that it still has same contents.
That's because I know it was the same number as we have seen here.
You still present in memory of.
This is what happens when you remove one of the hard links, all remaining killings will still have
the same content as before.
But there's a difference between hard and soft links.
And again, you could use them if you will simply need to have a specific file or files or folders in
different locations.
This all guys, for this lecture.
I hope you enjoyed it.
And next, let me explain you how to use a find comment.
I'll see you next.
Bye bye.