Тёмный
No video :(

MicroNuggets: Hard Links versus Soft Links Explained 

CBT Nuggets
Подписаться 328 тыс.
Просмотров 67 тыс.
50% 1

Start learning cybersecurity with CBT Nuggets. courses.cbt.gg...
In this video, Shawn Powers covers the difference between hard links and soft (or symbolic) links on a Linux OS 10 operating system. These are essentially two different ways that files are referenced on a hard drive, with the former pointing to the file itself and the latter directed towards the name of the file.
There are two primary types of links on a Linux OS 10: hard and soft (sometimes referred to as “symbolic”). A hard link begins with referencing a file that points to a specific spot on a hard drive where that data is stored. When you create a second file that points to the same location, it’s referred to as a hard-linked file. These two files behave separately except for one crucial distinction: when you change the data on one file, it updates the data in the other to reflect the changes. In a soft link, the original file is still located at a specific point on the hard drive. When a secondary file is created and soft-linked, the only role that secondary file plays is to point to the file one descriptor or name.
📁 Download the Ultimate Sysadmin Cert Guide: blog.cbt.gg/ttri
⬇️ 4-Week Study Plan: MD-100 & MD-101: blog.cbt.gg/p4ym
Start learning with CBT Nuggets:
• Linux Security | courses.cbt.gg...
• Everything Linux | courses.cbt.gg...
• Linux Bash Training | courses.cbt.gg...
• Linux Essentials | courses.cbt.gg...

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 109   
@jvsnyc
@jvsnyc 5 лет назад
This is a better explanation than most on RU-vid, but the size shown in ls is misleading! If I have a 60GB file with 20 hard links to it, it still takes up just 60GB, not 60GB * 20. ls dash l will show the original full 60GB size for each place that a hard link exists, which is confusing/wrong. In some quick experiments it appears that du only counts each hardlink'ed file once, not per each hardlink. A soft link doesn't save space. There are still at least two reasons you would prefer them. They can point to directories as well as to plain files. Also, they can point to anything that can be expressed under root ( "/" ) i.e. anything you can type. Hard-links can only point to something within the same partition/volume/mount point, because they specify the inode # which is specific to a given partition, volume or mount point. This advantage goes away if you know for an absolute fact everything is on the same big partition, but you need to be careful if there are multiple mounts/partitions. Hard-links can't break by someone removing a file that they don't realize you have soft-linked to. Also, when you do an ls on them one of the things it shows you is the reference count, which is not affected by soft links, so just seeing a reference count of 1 doesn't mean it is safe to remove a file, there could be any number of soft-links to that file or directory which will break the minute you remove it. Unix and Linux are still wonderful and awesome, but many people are confused about these points and you do need to be careful about this.
@aayyaa1188
@aayyaa1188 3 года назад
This is the best explanation I've found on RU-vid. Thank you sooooo much for making the concept of soft link and hard link so clear.
@cbtnuggets
@cbtnuggets 3 года назад
Glad it was helpful!
@Adedayodeji
@Adedayodeji Год назад
Entirely true!
@param2609-p9m
@param2609-p9m Год назад
Right🎉
@mattr7229
@mattr7229 Год назад
This is an awesome explanation. No editorializing, just what I need know explained in a short, easy to understand, and concise manner. Thank you.
@beto.aveiga
@beto.aveiga 2 года назад
Great explanation. The only thing missing would be practical examples on when to implement one or the other. I mean, real-life scenarios where you would prefer a soft link vs. a hard link, or vice-versa.
@codygosney976
@codygosney976 Год назад
Agreed, do you have an example of practical usage for these two concepts?
@JpsBookOfLife
@JpsBookOfLife Год назад
Hard Link -Space saving and data consistency: Suppose you have a large data file that needs to be accessed from multiple locations or by different users, but you don't want to consume extra disk space by creating copies. Hard links can be a good option here, as they will allow you to access the file from different locations without duplicating the file content. Plus, any modifications to the file content will be consistent across all hard links, since they all point to the same data. Backup purposes: Hard links can be used in some backup strategies. If you make a backup of a file by creating a hard link, and later make changes to the original file, the backup will still contain the original data. This can be handy for creating "snapshots" of files or directories at different points in time. Symbolic Link (Soft Link) -Linking directories: Only symbolic links can be used to link directories. So, for instance, if you're organizing your music files and want to have the same directory appear under multiple genres, you could use symbolic links to achieve this. Cross filesystem linking: If you need to create a link to a file or directory that resides on a different filesystem or partition, you'll need to use a symbolic link. Versioning systems: Soft links are often used in versioning systems. For example, in a situation where you have different versions of an application, you can create a symbolic link named "current" that points to the directory of the version currently in use. When you want to switch to a different version, you just need to change the symbolic link to point to a different directory. Broken Link Situations: There are cases where you might want a link to survive the removal of the original file. With a symbolic link, the link will remain (but will point to a non-existing file), and you can replace the original file later without needing to update the link.
@ransazz
@ransazz Год назад
So basically, they're shortcuts! I'd imagine soft links are more similar to Windows shortcuts because if u delete the original file in Windows, the shortcut no longer functions despite being there (and also takes up very little space). I had trouble making the connection because hard and soft links seemed a bit abstract to me before I understood that. Thanks for the video!
@andrewjoe1836
@andrewjoe1836 2 года назад
This is the absolute best explanation I found yet and it was under 10 minutes long and I feel like I know what I need to understand the concept very well.
@annexgroup6878
@annexgroup6878 2 года назад
Im so glad you use visuals. Thank you so much for explaining this.
@RockTheCage55
@RockTheCage55 9 месяцев назад
like others have said definitely the best explanation on youtube. Maybe i'm wrong but when deciding to use a hard or soft links i would think you would want to use hard links when you want to avoid broken links & don't want the data to deleted until the last use. I would think hard links would be more useful in most cases. Thanks for the great explanation
@quinton6463
@quinton6463 9 месяцев назад
This is a fantastic video. I feel like a have a firm grasp on the concept after following along, all in under 10 minutes. Thank you!
@manuelconte2127
@manuelconte2127 2 года назад
2022, still great explanation.
@aaronholt6595
@aaronholt6595 Год назад
🤣 massively appreciated the 'danger Will Robinson' comment half way through.
@bouhannacheabdallah
@bouhannacheabdallah 4 года назад
Among so many videos u r the first. One that gave the correct way of explanation
@cbtnuggets
@cbtnuggets 4 года назад
Thank you so much 🙂
@Devildoc512
@Devildoc512 7 месяцев назад
wow, that was a perfect presentation!
@Luffy-um8jo
@Luffy-um8jo Год назад
You cleared my doubt. Thanks
@memedaddyz
@memedaddyz 2 года назад
man this is the best explanation i've encountered so far omg
@Mark-nm9sm
@Mark-nm9sm 11 месяцев назад
best explanation hands down. Thank you
@k_usuan
@k_usuan Год назад
Thank you so much . I just feel happier doing it and experimenting while listening.
@antosolisr
@antosolisr Год назад
gracias, es mil veces mejor su explicacion de menos de 10 minutos que horas de clase en mi universidad: UNLAM.
@zsoltory4176
@zsoltory4176 5 лет назад
Those familiar with C++11 or newer may find it helpful, to think of hard links somehow like right value reference, while soft link resemble to a normal (left value) reference. A left value reference references the name of an object, while the data itself is referenced via the ref assigned to that name. A right value reference references the content of a data object directly, without taking the detour trough the name.
@Abhi1104
@Abhi1104 6 дней назад
Thanks for explaining simple
@MorkusReX
@MorkusReX 4 года назад
So with hard links, the two files claim they have size X, but actually only X is taken from the storage, correct?
@roathkanel
@roathkanel 3 года назад
Thank you very much for your video. This is very helpful to me to understand about how hard link and soft link work in linux. It would be great if you could provide an example where hard link is actually use in a real life.
@cbtnuggets
@cbtnuggets 3 года назад
Hi Kanel, thank you for your comment! We're glad you enjoyed the video. We recommend checking out this blog post on our website for more in-depth information into hard versus soft links: www.cbtnuggets.com/blog/certifications/open-source/linux-hard-links-versus-soft-links-explained
@ivankwapong6298
@ivankwapong6298 2 года назад
You made it so easy for me to understand these links. Thanks!
@priyapandey9219
@priyapandey9219 2 года назад
best explanation ever about this topic. I appreciate your skills.
@sanaharmony8993
@sanaharmony8993 2 года назад
Thank you soooo much for making my school life so much easier!🥰
@amalmokdad8880
@amalmokdad8880 8 месяцев назад
Truly incredible thank you for the explanation you're the best !
@The1987Julian
@The1987Julian Год назад
5:37 Danger Will Robinson!!!
@soundinducedflow
@soundinducedflow 2 года назад
Great explanation, thanks I get it.
@samucancld
@samucancld 4 месяца назад
Best video on the subject, thx
@gardetanmay5457
@gardetanmay5457 2 года назад
CRISP AND CLEAR ,THANKS
@kdedesko
@kdedesko Год назад
Nice job. Really good explanation.
@amirsaba80
@amirsaba80 2 года назад
Perfect explanation. thank you
@mohitswain8441
@mohitswain8441 3 года назад
Understandable! Have a nice Day!
@trial000000000000001
@trial000000000000001 Год назад
Very Clear. Thank you
@linuxbd6769
@linuxbd6769 3 года назад
Beautiful explanation Sir.
@rohanwaghulkar3551
@rohanwaghulkar3551 2 года назад
Thank you... that was the best explanation
@divinomatheus6212
@divinomatheus6212 9 месяцев назад
That's an excellent video! But somethings still sounds a little bit confusing to me. If files are just references that point to an address on the hard drive where the values persists on. Where those references are persisted?
@cohaisudethuongangnhinnhau6236
thank you for your explanation
@zsoltory4176
@zsoltory4176 5 лет назад
I also use hard links to work on the same C++ project (on the same code base) with different ide, e. g. code::blocks and Kdevelop, using hardlinks on the code files (cpp,h,hpp)
@LARPANET_3087
@LARPANET_3087 Год назад
Very clear explanation. Subscribed!
@memedaddyz
@memedaddyz 2 года назад
just one question - are your full courses on website same amazing like here or they are good only on yt?
@cbtnuggets
@cbtnuggets 2 года назад
You can find the same great videos on the website!
@jasonhuang4333
@jasonhuang4333 2 года назад
Good explanation!
@vasilikipitsilou3599
@vasilikipitsilou3599 2 года назад
that's a great explanation.
@moncefarajdal4582
@moncefarajdal4582 2 года назад
Thanks a lot for this video.
@emilxrd
@emilxrd Год назад
thank you so much for this video!!
@smartbear173
@smartbear173 9 месяцев назад
太清晰啦!谢谢!
@eminedogan3125
@eminedogan3125 2 года назад
Thank you so much, super clear explanation!
@etiniarchibong
@etiniarchibong Год назад
yes, it has been really informative and educative. Thanks
@MrVeriface
@MrVeriface 4 года назад
You're explanation saved me!
@cbtnuggets
@cbtnuggets 4 года назад
Glad to hear it! You've got this!
@kennymccormic7578
@kennymccormic7578 5 лет назад
Thank you, sir! A perfect explanation!
@tejashwini54321
@tejashwini54321 3 месяца назад
Thank you so much sir
@mahamadounouridinemamoudou9875
@mahamadounouridinemamoudou9875 2 года назад
thank a lot :)
@allandossantosgama8597
@allandossantosgama8597 Год назад
very good. Thanks
@justavideo24
@justavideo24 Год назад
Thank you very much
@bendustin7609
@bendustin7609 7 месяцев назад
Thank you!
@med3060
@med3060 3 года назад
thank you for the great explanation !
@oktiennoeis3200
@oktiennoeis3200 3 года назад
Thank you, really good explained!!!
@eilayyosfan4417
@eilayyosfan4417 2 месяца назад
a very good video thank you
@filippo7349
@filippo7349 Год назад
Today it's possible to create symlinks and hard links in Windows. Even hard links to directories (it's called junctions).
@ArashArzandehnia
@ArashArzandehnia 4 года назад
Awesome Explanation such as always Thanks
@cbtnuggets
@cbtnuggets 4 года назад
Thank you, Arash!
@huntersneed4025
@huntersneed4025 Год назад
how does a hard link take more data if its pointing to the same spot in memory?
@julianalconcher7849
@julianalconcher7849 8 месяцев назад
AWESOME!
@Faladrin
@Faladrin Год назад
1:40 he points out that using a soft link takes up almost no space but doesn't mention this same fact for the hard link. Hard links also do not copy the actual file data and do not take up hardly any space (in fact hard links should usually take up slightly less space than soft links).
@Faladrin
@Faladrin Год назад
Watching the video again this guy seems to think the hard link file doubles the storage used, which it doesn't. The video has some serious flaws resulting from his misunderstanding of how this works.
@AishwaryaRadhakrishnan34
@AishwaryaRadhakrishnan34 3 года назад
Amazing explanation!
@cbtnuggets
@cbtnuggets 3 года назад
Glad you liked it, thank you for watching!
@5urg3x
@5urg3x 4 года назад
What was the original use case for hard links? I’m just not seeing why they were ever used in the first place.
@kb-zealot
@kb-zealot 11 месяцев назад
imo symlinks are the better option for most cases. I have never used hardlinks and no one that I know has either.
@user-uc7mi9nn1r
@user-uc7mi9nn1r Год назад
great job😀
@abcjme
@abcjme 6 лет назад
Isn't a hard-link file the same as a duplicated file?
@jvsnyc
@jvsnyc 5 лет назад
There is only one real file no matter how many hard-links there are. If you duplicate a file five times, it takes five times as much space, and you can change any of them and that copy will change without changing any of the others.
@parkerchu5675
@parkerchu5675 4 года назад
Great video! Thank you
@cbtnuggets
@cbtnuggets 4 года назад
Glad you liked it, thank you Parker!
@ilya_123__
@ilya_123__ Год назад
thank you!!!
@ReToRx
@ReToRx Год назад
Thank you
@YannMetalhead
@YannMetalhead 2 года назад
Good video.
@yinonelbaz5309
@yinonelbaz5309 2 года назад
thanks a lot!!!
@rohithharidas5532
@rohithharidas5532 10 месяцев назад
thanks fam!
@darkmkv
@darkmkv 4 года назад
you da man! thank you
@ricko13
@ricko13 3 года назад
so if you have 100 hardlinks you gotta delete 'em all to actually free the space on the disk right?
@asmrspace44
@asmrspace44 4 года назад
شرحك روعه 👍❤️ you are the best 😴
@gogochannel1959
@gogochannel1959 6 лет назад
I found on google that softlinks take more space than hardlinks. Is it true?
@RAJESHKUMAR-tr6rf
@RAJESHKUMAR-tr6rf 6 лет назад
really useful ......Thank u Sir
@magicandmagik
@magicandmagik 7 лет назад
thanks! loved the video
@PrashantSedhainOfficial
@PrashantSedhainOfficial 4 года назад
Thanks!
@android4261
@android4261 5 лет назад
Hi Shawn, thanks for this explanation and the video! You've mentioned, that in the case of two hard linked files, if you edit one, the other one gets edited also. But how come that if you delete one of the two files, the other one stays intact?
@krishreal2024
@krishreal2024 5 лет назад
Andro Id analogy: think of two people living at the same house . If you do reno(like edit) then both have to live through the reno. Now if one person decides to move , the other person will still live in the same house - the same address .
@rogernevez5187
@rogernevez5187 5 лет назад
I'm wondering when hard/soft links are useful ...
@azharahmed7588
@azharahmed7588 5 лет назад
I'm actually looking for that answer. I can say soft links are used as a short cut, you don't want to type absolute path when it's really long, instead create a soft link and use it to navigate. I still didn't understand the purpose of a hard link.
@choudhary6964
@choudhary6964 5 лет назад
@@azharahmed7588 when you give your pc to your evil sister or evil friend, they can't go in sudo "original file" But they may delete hard link file
@KarthikS30712
@KarthikS30712 Год назад
Ok.. So why are they used?
@linuxvoice1043
@linuxvoice1043 7 месяцев назад
nice good
@grantas3564
@grantas3564 Год назад
great
@diingyangloh8094
@diingyangloh8094 Год назад
Noice!
@csmania8263
@csmania8263 4 года назад
very clear explanation, thank you!
@cbtnuggets
@cbtnuggets 4 года назад
Glad it was helpful!
@BiblicalArchaeologyAR
@BiblicalArchaeologyAR 3 года назад
THANK YOU!
@cbtnuggets
@cbtnuggets 3 года назад
Glad it was helpful, R B! Thanks for watching the video.
@joe4343
@joe4343 6 лет назад
THANKS!!!!
Далее
Linux Crash Course - Symbolic Links
30:07
Просмотров 61 тыс.
Hard and Soft Links in Linux
18:07
Просмотров 120 тыс.
Как дела перцы?
00:25
Просмотров 52 тыс.
3d printed demon core vs real
00:24
Просмотров 6 млн
Manipulating Text in Linux Head, Tail, Cat, Split
9:00
MicroNugget: IP SLA
6:21
Просмотров 65 тыс.
Understanding Linux and UNIX inodes and file metadata
13:46
Linux inodes Explained
8:53
Просмотров 72 тыс.
"Everything is a file" in UNIX
11:14
Просмотров 45 тыс.
I've been using Redis wrong this whole time...
20:53
Просмотров 356 тыс.
Running a Buffer Overflow Attack - Computerphile
17:30
Как дела перцы?
00:25
Просмотров 52 тыс.