Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet186/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   182   183   184   185   186   187   188   189   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

symbolic links
 or 
symlink
) is an entry that points to another 
directory or file. This is different to a hard link, because a hard link is a duplicate 
entry that references an inode, while a symbolic link references a specific path. 
Symbolic links can not only be moved around between filesystems; we can also 
create a symbolic link to a directory as well. To illustrate how a symbolic link works, 
let's create one. In my case, I'll delete 
file3
 and recreate it as a symbolic link. We'll 
again use the 
ln
 command:
rm file3
ln -s file1 file3


Chapter 5
[
 137 
]
With the 
-s
 option of 
ln
, I'm creating a symbolic link. First, I deleted the original 
hard link with the 
rm
 command (which doesn't disturb the original file, 
file1
) and 
then created a symbolic link, also named 
file3
. If we use 
ls -i
 again, we'll see that 
file3
 does not have the same inode number as 
file1
:
Figure 5.10: Output of ls -i after creating a symbolic link
Notice that the inode numbers of each file are all different. At this point, the main 
difference compared with a hard link should become apparent. A symbolic link is 
not a clone of the original file; it's simply a pointer to the original file's path. Any 
commands you execute against 
file3
 are actually being run against the target that 
the link is pointing to. Hard links on the other hand, point directly to the file.
In practice, symbolic links are incredibly useful when it comes to server 
administration. However, it's important not to go crazy and create a great number 
of symbolic links all over the filesystem. This certainly won't be a problem for you 
if you are the only administrator on the server, but if you resign and someone 
takes your place, it will be a headache for them to figure out all of your symbolic 
links and map where they lead to. You can certainly create documentation for your 
symbolic links, but then you'd have to keep track of them and constantly update 
documentation. My recommendation is to only create symbolic links when there are 
no other options, or if doing so benefits your organization and streamlines your file 
layout.
Getting back to the subject of symbolic links versus hard links, you're probably 
wondering which one you should use and when to use it. The main benefit of a hard 
link is that you can move either file (the link or the original) to anywhere on the same 
filesystem and the link will not break. This is not true of symbolic links; however, if 
you move the original file, the symbolic link will be pointing to a file that no longer 
exists at that location. Hard links are basically duplicate entries pointing to the same 
object, and thus have the same inode number, so both will have the same file size 
and content. A symbolic link is a pointer to the file's path—nothing more, nothing 
less.


Managing Files and Directories

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   182   183   184   185   186   187   188   189   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish